Sha256: 1e77e91e45c9a95b83098d1663fb16f382e3c630d543c0a4f45c91b29638be27

Contents?: true

Size: 686 Bytes

Versions: 8

Compression:

Stored size: 686 Bytes

Contents

module Phcpresspro
  class Article::Category < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

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

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

8 entries across 8 versions & 1 rubygems

Version Path
phcpresspro-86.4.0 app/models/phcpresspro/article/category.rb
phcpresspro-86.3.0 app/models/phcpresspro/article/category.rb
phcpresspro-86.2.0 app/models/phcpresspro/article/category.rb
phcpresspro-86.1.0 app/models/phcpresspro/article/category.rb
phcpresspro-86.0.0 app/models/phcpresspro/article/category.rb
phcpresspro-85.0.0 app/models/phcpresspro/article/category.rb
phcpresspro-84.0.0 app/models/phcpresspro/article/category.rb
phcpresspro-83.0.0 app/models/phcpresspro/article/category.rb