Sha256: cf62dcdb3c5c6392c3bef4bfa69c05a118edc6e62922f26ad5e5fdcdc6a810e0

Contents?: true

Size: 674 Bytes

Versions: 7

Compression:

Stored size: 674 Bytes

Contents

module Phcpress
  class Article::Category < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

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

    # Relationships
    has_and_belongs_to_many :posts, class_name: 'Phcpress::Article::Post', :join_table => 'categories_posts', :dependent => :destroy
    belongs_to :user, class_name: 'Phcaccounts::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

7 entries across 7 versions & 1 rubygems

Version Path
phcpress-56.4.0 app/models/phcpress/article/category.rb
phcpress-56.3.0 app/models/phcpress/article/category.rb
phcpress-56.2.0 app/models/phcpress/article/category.rb
phcpress-56.1.0 app/models/phcpress/article/category.rb
phcpress-56.0.0 app/models/phcpress/article/category.rb
phcpress-55.0.0 app/models/phcpress/article/category.rb
phcpress-54.0.0 app/models/phcpress/article/category.rb