Skip to content

Commit

Permalink
Merge pull request #406 from rafael/master
Browse files Browse the repository at this point in the history
[Fix]  dirty attributes incorrect when list assignment as an array and non-comma delimiter
  • Loading branch information
bf4 committed Jan 1, 2014
2 parents 3ba7759 + 2779e8b commit 41c4751
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/acts_as_taggable_on/acts_as_taggable_on/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def tagging_contexts
end

def process_dirty_object(context,new_list)
value = new_list.is_a?(Array) ? new_list.join(', ') : new_list
value = new_list.is_a?(Array) ? ActsAsTaggableOn::TagList.new(new_list) : new_list
attrib = "#{context.to_s.singularize}_list"

if changed_attributes.include?(attrib)
Expand Down
16 changes: 16 additions & 0 deletions spec/acts_as_taggable_on/taggable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,22 @@
it 'does not show any changes to the taggable item' do
@taggable.changes.should == {}
end

context "and using a delimiter different from a ','" do
before do
@old_delimiter = ActsAsTaggableOn.delimiter
ActsAsTaggableOn.delimiter = ';'
end

after do
ActsAsTaggableOn.delimiter = @old_delimiter
end

it 'does not show any changes to the taggable item when using array assignments' do
@taggable.tag_list = ["awesome", "epic"]
@taggable.changes.should == {}
end
end
end
end

Expand Down

0 comments on commit 41c4751

Please sign in to comment.