Sha256: 053c2898dde0e367da8011dc111ac1cd485c9123f85450745324c774b50f0e85

Contents?: true

Size: 688 Bytes

Versions: 5

Compression:

Stored size: 688 Bytes

Contents

module PhcdevworksPress
  class Article::Category < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Paper Trail Initialize
    has_paper_trail :class_name => 'PhcdevworksPress::CategoryVersions'

    # Relationships
    has_and_belongs_to_many :posts, class_name: 'Article::Post', :join_table => 'categories_posts', :dependent => :destroy
    belongs_to :user, class_name: 'PhcdevworksAccounts::User'

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

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

    def phc_nice_url_slug
      [:category_name]
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
phcdevworks_press-1.1.0 app/models/phcdevworks_press/article/category.rb
phcdevworks_press-1.0.1 app/models/phcdevworks_press/article/category.rb
phcdevworks_press-1.0.0 app/models/phcdevworks_press/article/category.rb
phcdevworks_press-0.2.0 app/models/phcdevworks_press/article/category.rb
phcdevworks_press-0.1.0 app/models/phcdevworks_press/article/category.rb