Sha256: 583462a65d08d667a8d721ce4ddfa65de1d02b741914c27a77bfb9be8babee2d

Contents?: true

Size: 744 Bytes

Versions: 3

Compression:

Stored size: 744 Bytes

Contents

module PhcdevworksCoreModules
  class Modules::Category < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Paper Trail Initialize
    has_paper_trail :class_name => "PhcdevworksCoreModules::CoreCategoryVersions"

    # Relationships
    has_and_belongs_to_many :posts, class_name: "Article::Post", :join_table => "phcdevworks_press_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_core_category_nice_urls, use: [:slugged, :finders]

    def phcdev_core_category_nice_urls
      [:category_name]
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phcdevworks_core_modules-0.3.0 app/models/phcdevworks_core_modules/modules/category.rb
phcdevworks_core_modules-0.2.0 app/models/phcdevworks_core_modules/modules/category.rb
phcdevworks_core_modules-0.1.0 app/models/phcdevworks_core_modules/modules/category.rb