Sha256: 66ef5b28be918540f98c2de82420bae5d1840f5ff33c55b1debe2b420cc14190

Contents?: true

Size: 745 Bytes

Versions: 4

Compression:

Stored size: 745 Bytes

Contents

module Phcpresspro
  class Article::Category < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

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

    # Relationships
    has_and_belongs_to_many :posts, class_name: 'Phcpresspro::Article::Post', :join_table => 'categories_posts'
    belongs_to :user, class_name: 'Phcaccountspro::User'

    # Validation for Form Fields
    validates :catname,
      presence: true,
      uniqueness: true,
      length: { minimum: 3 }

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

    # Define for Multiple Records
    def phcpresspro_category_slug
      [
        [:catname]
      ]
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phcpresspro-81.0.0 app/models/phcpresspro/article/category.rb
phcpresspro-80.3.0 app/models/phcpresspro/article/category.rb
phcpresspro-80.2.0 app/models/phcpresspro/article/category.rb
phcpresspro-80.1.0 app/models/phcpresspro/article/category.rb