Module: ComfortableMexicanSofa::IsCategorized::InstanceMethods
- Defined in:
- lib/comfortable_mexican_sofa/extensions/is_categorized.rb
Instance Method Summary collapse
Instance Method Details
#sync_categories ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/comfortable_mexican_sofa/extensions/is_categorized.rb', line 34 def sync_categories (self.category_ids || {}).each do |category_id, flag| case flag.to_i when 1 if category = Comfy::Cms::Category.find_by_id(category_id) category.categorizations.create(:categorized => self) end when 0 self.categorizations.where(:category_id => category_id).destroy_all end end end |