2013-04-22 11:34:37 +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 08:15:37 +00:00
|
|
|
|
|
|
|
before_destroy :update_taggable_tag_ids
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def update_taggable_tag_ids
|
|
|
|
self.taggable.remove_id(self.tag.id)
|
|
|
|
end
|
2013-04-22 11:34:37 +00:00
|
|
|
end
|