Sha256: 4bd5ded1a5747aa58d7066b0c9f318bbf1f3300d851a2941339463d9e9aa0819

Contents?: true

Size: 670 Bytes

Versions: 1

Compression:

Stored size: 670 Bytes

Contents

module Phcmemberspro
  class Directory::Category < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Add Paper Trail
    has_paper_trail

    # Model Relationships
    has_many :categorylistings, class_name: 'Phcmemberspro::Directory::Categorylisting', dependent: :destroy
    has_many :listings, class_name: 'Phcmemberspro::Member::Listing', :through => :categorylistings

    validates :catname,
    length: { minimum: 3 }

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

    # Define for Multiple Records
    def phcmembers_category_slug
      [
        [:id, :catname]
      ]
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phcmemberspro-20.5.1 app/models/phcmemberspro/directory/category.rb