Just posting a solution (which started a problem I was going to post about)
I'm using acts_as_taggable_on_steroids with rails 2.0.1
When I would add tags (via a form) to my model they would go straight to that models cached_tag_list field as expected, but the tags and associations would never get saved to my tags and taggings tables. However, playing in console ... they would get saved fine!
I managed to figure out that i needed to add a
before_save 'self.save_tags'
to my 'acts_as_taggable' model .... after i did this associations were saving fine to both places ...
I am confused though ... as to why i would have to add this callback ... from what I can tell the plugin is supposed to do this already, confusing. Anyone know why the plugin doesn't do both?
from its source ... i see
def save_tags return unless @tag_list
new_tag_names = @tag_list - tags.map(&:name) old_tags = tags.reject { |tag| @tag_list.include? (tag.name) }
self.class.transaction do if old_tags.any? taggings.find(:all, :conditions => ["tag_id IN (?)", old_tags.map(&:id)]).each(&:destroy) taggings.reset end
new_tag_names.each do |new_tag_name| tags << Tag.find_or_create_with_like_by_name(new_tag_name) end end
true end
i was able to deduce that its returning because of @tag_list ... and not executing a normal save ... I asssume somewhere else that means @tag_list is being cleared, perhaps after the cached version is saved.