Sha256: 6c98eb0c7ada31b0bf9f8fab5636baa9431486ffe59edc917b54255e1c02efa0

Contents?: true

Size: 849 Bytes

Versions: 9

Compression:

Stored size: 849 Bytes

Contents

module PhcdevworksTutorials
  class Tutorial::Category < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Paper Trail Initialize
    has_paper_trail :class_name => 'PhcdevworksTutorials::TutorialCategoryVersions'

    #Relationships
    has_and_belongs_to_many :posts, class_name: "Tutorial::Post", :join_table => "phcdevworks_tutorials_categories_posts", :dependent => :destroy
    has_and_belongs_to_many :posts, class_name: "Command::Post", :join_table => "phcdevworks_tutorials_categories_commands", :dependent => :destroy

    # Form Fields Validation
    validates :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
      [:category_name]
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
phcdevworks_tutorials-6.11.0 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-6.10.2 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-6.10.1 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-6.10.0 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-6.9.0 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-6.8.0 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-6.7.0 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-6.6.4 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-6.6.3 app/models/phcdevworks_tutorials/tutorial/category.rb