lib/acts_as_taggable.rb
def update_tags
          if @new_tag_list
            Tag.transaction do
              # this needs commenting.  why only remove tags for the user?
              unless @new_user_id
                taggings.destroy_all
              else
                taggings.find(:all, :conditions => "user_id = #{@new_user_id}").each do |tagging|
                  tagging.destroy
                end
              end

              #moved parse into tag_list = so we can assign to tagnames if present for caching
              @new_tag_list.each do |name|
                Tag.find_or_create_by_name(name).tag(self, @new_user_id)
              end

              tags.reset
              taggings.reset
              @new_tag_list = nil
            end
          end
        end
# Warning: Not updated until save is called!
# hmm, want to update cache before the item is saved so we don't have to do another query
Not updated until save is called.
hmm, want to update cache before the item is saved so we don't have to do another query
Not updated until save is called . hmm want to update cache before the item is saved so we don ' t have to do another query
def update_tags
          if @new_tag_list
            Tag.transaction do
              unless @new_user_id
                taggings.destroy_all
              else
                taggings.find(:all, :conditions => "user_id = #{@new_user_id}").each do |tagging|
                  tagging.destroy
                end
              end
              @new_tag_list.each do |name|
                Tag.find_or_create_by_name(name).tag(self, @new_user_id)
              end
              tags.reset
              taggings.reset
              @new_tag_list = nil
            end
          end
        end
def update_tags if @new_tag_list Tag . transaction do unless @new_user_id taggings . destroy_all else taggings . find ( :all , :conditions => "user_id = #{@new_user_id}" ) . each do | tagging | tagging . destroy end end @new_tag_list . each do | name | Tag . find_or_create_by_name ( name ) . tag ( self , @new_user_id ) end tags . reset taggings . reset @new_tag_list = nil end end end
Warning: Not updated until save is called!
Warning : Not updated until save is called!
# this needs commenting.  why only remove tags for the user? #moved parse into tag_list = so we can assign to tagnames if present for caching