{"issue":{"milestone":null,"user":{"id":3574,"login":"okr","url":"https://api.github.com/users/okr","avatar_url":"https://secure.gravatar.com/avatar/05f531b29b8cadb5640b81394c602383?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"05f531b29b8cadb5640b81394c602383"},"title":"tag_list is not updated properly in rails 3","created_at":"2010-08-03T18:10:28Z","updated_at":"2011-12-18T06:41:51Z","labels":[],"state":"closed","id":267897,"html_url":"https://github.com/mbleigh/acts-as-taggable-on/issues/95","closed_at":"2011-12-18T06:41:51Z","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"I have a form with a textfield for users to update a Post model's taglist by entering free form, comma seperated tags.  It seems that when I call update_attributes in my update action that it replaces that post's taglist with just the new tags that were added in the form and the older tags are removed from that post.  If no tags are changed/added in the form then the taglist is wiped clean.\r\n\r\nin my model I have\r\n\r\nclass Post < ActiveRecord::Base\r\n\r\n\tacts_as_taggable_on :tags\r\n\r\nend\r\n\r\nmy update action is..\r\n\r\ndef update\r\n\t@post = Post.find(params[:id])\r\n\r\n\trespond_to do |format|\r\n\t\tif @post.update_attributes(params[:post])\r\n\t\t\tformat.html { redirect_to admin_post_url(@post), :notice => 'Post was successfully updated.' }\r\n\t\t\tformat.js\r\n\t\telse\r\n\t\t\tformat.html { render :action => \"edit\" , :alert => 'Post was not successfully updated.'}\r\n\t\tend\r\n\tend\r\nend\r\n\r\nand in my Post form I have...\r\n\r\n<label for=\"tag_list\">Enter tags below, limit: 20, comma seperated</label>\r\n<div class=\"clear\"></div>\r\n<div id=\"tags\">  \r\n\t<%= f.text_field :tag_list %> \r\n</div>\r\n\r\nI'm using rails 3.0.0.rc and acts-as-taggable-on 2.0.6","number":95,"url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/95","comments":5,"assignee":null},"comment":{"user":{"id":25120,"login":"artemk","url":"https://api.github.com/users/artemk","avatar_url":"https://secure.gravatar.com/avatar/57b5309e59253ef8b6f096d14358d82a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"57b5309e59253ef8b6f096d14358d82a"},"created_at":"2011-12-18T06:41:51Z","updated_at":"2011-12-18T06:41:51Z","id":3193487,"body":"@erichurst is right. \r\n1) remove tag_list from params[:post]. For current implementation passing tag_list along to update_attributes will change hole tag_list.\r\n\r\n2) add it post using @post.tag_list.add.\r\n","url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/comments/3193487"},"action":"created"}