Sha256: f6ca26fed94895906042223d8c4d94b639e7ec5882b779c3a3fe5d47cad935d3

Contents?: true

Size: 587 Bytes

Versions: 2

Compression:

Stored size: 587 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 => "phcdevworks_tutorials_categories_posts", :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

2 entries across 2 versions & 1 rubygems

Version Path
phcdevworks_tutorials-4.0.1 app/models/phcdevworks_tutorials/tutorial/category.rb
phcdevworks_tutorials-4.0.0 app/models/phcdevworks_tutorials/tutorial/category.rb