app/models/phcmembers/directory/category.rb in phcmembers-61.0.0 vs app/models/phcmembers/directory/category.rb in phcmembers-61.3.0
- old
+ new
@@ -6,23 +6,20 @@
# Paper_tail Initialize
has_paper_trail :class_name => 'Phcmembers::CategoryVersions'
# Relationships
- has_many :categorylistings, class_name: 'Phcmembers::Directory::Categorylisting', dependent: :destroy
- has_many :listings, class_name: 'Phcmembers::Member::Listing', :through => :categorylistings
+ has_and_belongs_to_many :listings, class_name: 'Phcmembers::Member::Listing', :join_table => 'categories_listings'
validates :catname,
- length: { minimum: 3 }
+ length: { minimum: 3 }
# Clean URL Define
friendly_id :phcmembers_category_slug, use: [:slugged, :finders]
# Define for Multiple Records
def phcmembers_category_slug
- [
- :catname
- ]
+ [:catname]
end
end
end