orbit-4-2/app/models/buffer_category.rb

16 lines
314 B
Ruby

class BufferCategory
include Mongoid::Document
include Mongoid::Timestamps
belongs_to :category
belongs_to :categorizable, polymorphic: true
before_destroy :remove_categorizable_category_id
private
def remove_categorizable_category_id
self.categorizable.remove_id(self.category.id)
end
end