From a3710a131e0bcfc1d1939f28246f4e9f60732835 Mon Sep 17 00:00:00 2001 From: tejo Date: Tue, 28 Oct 2008 03:53:33 -0700 Subject: [PATCH] change _add_tags method to play nice with rails 2.2 --- generators/tagging/templates/tagging_extensions.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/generators/tagging/templates/tagging_extensions.rb b/generators/tagging/templates/tagging_extensions.rb index 280aa3c..61c692a 100644 --- a/generators/tagging/templates/tagging_extensions.rb +++ b/generators/tagging/templates/tagging_extensions.rb @@ -1,4 +1,3 @@ - class ActiveRecord::Base #:nodoc: # These extensions make models taggable. This file is automatically generated and required by your app if you run the tagging generator included with has_many_polymorphs. @@ -13,7 +12,7 @@ def _add_tags incoming begin tag = Tag.find_or_create_by_name(tag_name) raise Tag::Error, "tag could not be saved: #{tag_name}" if tag.new_record? - tag.taggables << self + tags << tag rescue ActiveRecord::StatementInvalid => e raise unless e.to_s =~ /duplicate/i end @@ -66,7 +65,11 @@ def tag_list #:nodoc: <%= parent_association_name -%>s.to_s #:startdoc: end - + + def tag_list=(value) + tag_with(value) + end + private def tag_cast_to_string obj #:nodoc: