app/models/phcmembers/directory/category.rb in phcmembers-2.2.0 vs app/models/phcmembers/directory/category.rb in phcmembers-3.0.0
- old
+ new
@@ -1,14 +1,17 @@
module Phcmembers
class Directory::Category < ActiveRecord::Base
+ # Add Paper Trail
+ has_paper_trail
+
# Model Relationship
- has_many :catlists, class_name: 'Directory::Catlist'
+ has_many :listings, class_name: 'Directory::Listing', dependent: :destroy
+ has_many :businesses, class_name: 'Members::Business', :through => :listings
# Validation for Form Fields
- validates :catname,
+ validates :catname,
presence: true,
- uniqueness: true,
length: { minimum: 3 }
end
end