Sha256: 0be79185c6c5263c164d20e7ed5e651c789b878fec42c59cc6382a753ca388be

Contents?: true

Size: 766 Bytes

Versions: 1

Compression:

Stored size: 766 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 :category_name,
      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
      [
        [:org_id, :category_name]
      ]
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phcpresspro-82.0.0 app/models/phcpresspro/article/category.rb