def tag(tags, options = {})
options = { :separator => ' ', :clear => false }.merge(options)
attributes = options[:attributes] || {}
tag_names = ActiveRecord::Acts::Taggable.split_tag_names(tags, options[:separator], normalizer)
self.clear_tags! if options[:clear]
tag_names.each do |name|
tag_record = tag_model.find(:first, :conditions=>["#{tag_model_name} = ?",name]) || tag_model.new(tag_model_name.to_sym => name)
if tags_join_model
tag_join_record = tags_join_model.new(attributes)
tag_join_record.tag = tag_record
tag_join_record.tagged = self
tag_collection << tag_join_record unless tagged_with?(name)
else
tag_collection.push_with_attributes(tag_record, attributes) unless tagged_with?(name)
end
end
end