module CategoryDb::ClassMacros
Public Instance Methods
has_many_categories( opts={} )
click to toggle source
# File lib/tagutils/categories/active_record.rb, line 4 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 ### check: use category_name instead of category_key ??? scope :with_category, ->(category_key){ joins(:categories).where('categories.key' => category_key) } end