Sha256: 36957b53a2f4c2c4b3eefff16726b888c487086f90b3ef909d0f547550562c71

Contents?: true

Size: 533 Bytes

Versions: 9

Compression:

Stored size: 533 Bytes

Contents

module PhcdevworksTutorials
  class Tutorial::Category < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    #Relationships
      has_many :posts, class_name: 'PhcdevworksTutorials::Tutorial::Post'

    # Form Fields Validation
    validates :tutorial_category_name,
      presence: true,
      uniqueness: true

    # Clean URL Define
    friendly_id :phcdev_tutorials_category_nice_urls, use: [:slugged, :finders]

    def phcdev_tutorials_category_nice_urls
      [:tutorial_category_name]
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
phcdevworks_tutorials-1.2.1 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-1.2.0 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-1.1.1 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-1.1.0 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-1.0.2 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-1.0.1 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-1.0.0 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-0.5.0 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-0.4.0 app/models/phcdevworks_tutorials/tutorial/category.rb