Skip to content

Commit

Permalink
change _add_tags method to play nice with rails 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tejo committed Oct 28, 2008
1 parent 1f2148a commit a3710a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions 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.
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a3710a1

Please sign in to comment.