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 # Define for Multiple Records def phcmembers_category_slug [ [:id, :catname] ] end end end