24
25
26
27
28
29
30
31
32
|
# File 'lib/tagutils/active_record.rb', line 24
def has_many_categories( opts={} )
puts " [CategoryDb.has_many_categories] adding categorizations n category has_many assocs to model >#{name}<"
has_many :categorizations, class_name: 'CategoryDb::Model::Categorization', :as => :categorizable
has_many :categories, class_name: 'CategoryDb::Model::Category', :through => :categorizations
scope :with_category, ->(category_key){ joins(:categories).where('categories.key' => category_key) }
end
|