Module: Adva::Categorizable::ClassMethods
- Defined in:
- lib/adva/active_record/categorizable.rb
Instance Method Summary collapse
Instance Method Details
#categorized(category_id) ⇒ Object
17 18 19 20 21 |
# File 'lib/adva/active_record/categorizable.rb', line 17 def categorized(category_id) category = Category.find(category_id) category_ids = category.self_and_descendants.map(&:id) includes(:categorizations).where(:categorizations => { :category_id => category_ids }) end |