Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix small bug with dirty attributes and list assignment as an array. #406

Merged
merged 2 commits into from
Jan 1, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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