Sha256: c1421c3437ddb15aea762b29a1a307deb36da173f15fe215b39948f248cc25d6

Contents?: true

Size: 583 Bytes

Versions: 8

Compression:

Stored size: 583 Bytes

Contents

module PhcdevworksTutorials
  class Tutorial::Category < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    #Relationships
    has_and_belongs_to_many :posts, class_name: 'Tutorial::Post', :join_table => 'categories_posts', :dependent => :destroy

    # 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

8 entries across 8 versions & 1 rubygems

Version Path
phcdevworks_tutorials-2.1.2 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-2.1.1 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-2.1.0 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-2.0.0 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-1.2.5 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-1.2.4 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-1.2.3 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-1.2.2 app/models/phcdevworks_tutorials/tutorial/category.rb