def set_tags(tag_list, options = {})
      options.reverse_merge! :context => nil, 
                             :tagger => nil, 
                             :downcase => true,
                             :delimiter => ','

      if block_given?
        tags = yield(klass)
      else
        tags = EasyTag::Tag.compact_tag_list(tag_list, options.slice(:downcase, :delimiter))
      end

      context = compact_context(options[:context])
      tagger = compact_tagger(options[:tagger])

      # Remove old tags
      self.taggings.where(:tag_context_id => context.try(:id), :tagger_id => tagger.try(:id)).destroy_all
      # TODO: should remove unused tags and contexts

      if tags
        tags.each do |t|
          tag = EasyTag::Tag.where(:name => t).first_or_create
          raise SimgleTag::InvalidTag if tag.nil?
          self.taggings.where(:tagger_id => tagger.try(:id), :tag_context_id => context.try(:id), :tag_id => tag.id).first_or_create
        end
      end
    end
def set_tags(tag_list, options = {})
      options.reverse_merge! :context => nil, 
                             :tagger => nil, 
                             :downcase => true,
                             :delimiter => ','

      if block_given?
        tags = yield(klass)
      else
        tags = EasyTag::Tag.compact_tag_list(tag_list, options.slice(:downcase, :delimiter))
      end

      context = compact_context(options[:context])
      tagger = compact_tagger(options[:tagger])

      # Remove old tags
      self.taggings.where(:tag_context_id => context.try(:id), :tagger_id => tagger.try(:id)).destroy_all
      # TODO: should remove unused tags and contexts

      if tags
        tags.each do |t|
          tag = EasyTag::Tag.where(:name => t).first_or_create
          raise SimgleTag::InvalidTag if tag.nil?
          self.taggings.where(:tagger_id => tagger.try(:id), :tag_context_id => context.try(:id), :tag_id => tag.id).first_or_create
        end
      end
    end
end of class methods