Sha256: 6bf479a32bdef93a9a75ace1191b622bef88c9caa78fb27b848fe03f50775bcf

Contents?: true

Size: 720 Bytes

Versions: 6

Compression:

Stored size: 720 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 :phcdev_article_category_nice_urls, use: [:slugged, :finders]

    def phcdev_article_category_nice_urls
      [:category_name]
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
phcdevworks_press-1.3.1 app/models/phcdevworks_press/article/category.rb
phcdevworks_press-1.3.0 app/models/phcdevworks_press/article/category.rb
phcdevworks_press-1.2.1 app/models/phcdevworks_press/article/category.rb
phcdevworks_press-1.2.0 app/models/phcdevworks_press/article/category.rb
phcdevworks_press-1.1.2 app/models/phcdevworks_press/article/category.rb
phcdevworks_press-1.1.1 app/models/phcdevworks_press/article/category.rb