Orbit/app/models/tagging.rb

17 lines
305 B
Ruby
Raw Normal View History

2013-04-26 03:18:57 +00:00
class Tagging
include Mongoid::Document
include Mongoid::Timestamps
field :to_destroy, default: false
belongs_to :tag
belongs_to :taggable, polymorphic: true
2013-05-03 02:01:26 +00:00
before_destroy :update_taggable_tag_ids
private
def update_taggable_tag_ids
self.taggable.remove_id(self.tag.id)
end
2013-04-26 03:18:57 +00:00
end