Displaying 1 result from an estimated 1 matches for "add_tags_to_picture".
2005 May 23
1
has_and_belongs_to_many dual insert error ?
...Domain objects
--------------
class Picture < ActiveRecord::Base
has_and_belongs_to_many :tags
def update_tags(tags)
tags = tags.collect! {|name| name.downcase}
reject_invalid_tags(tags)
remove_deleted_tags(tags)
reject_existing_tags(tags)
add_tags_to_picture(tags)
end
protected
def reject_invalid_tags(tags)
tags.reject! { |name| name.nil? or name.empty? }
end
def remove_deleted_tags(tags)
self.tags.each {|tag|
self.tags.delete(tag) unless tags.include?(tag.tag)
}
end
def reject_ex...