Permalink
Browse files

No commit message

  • Loading branch information...
1 parent 23ddde9 commit 72fdf04dc52922a12214e4e99e0a4cf3f3856e44 @jviney committed Jul 8, 2007
Showing with 16 additions and 1 deletion.
  1. +4 −0 CHANGELOG
  2. +6 −1 lib/acts_as_taggable.rb
  3. +6 −0 test/acts_as_taggable_test.rb
View
@@ -1,3 +1,7 @@
+[8 July 2007]
+
+* find_options_for_tagged_with should not alter its arguments
+
[1 July 2007]
* Fix incorrect tagging when the case of the tag list is changed.
View
@@ -37,7 +37,12 @@ module SingletonMethods
# :match_all - Find models that match all of the gievn tags, not just one
# :conditions - A piece of SQL conditions to add to the query
def find_options_for_tagged_with(tags, options = {})
- tags = TagList.from(tags).names if tags.is_a?(String)
+ tags = if tags.is_a?(String)
+ TagList.from(tags).names
+ else
+ tags.dup
+ end
+
tags.compact!
tags.map!(&:to_s)
@@ -38,6 +38,12 @@ def test_find_options_for_tagged_with_no_tags_returns_empty_hash
assert_equal Hash.new, Post.find_options_for_tagged_with([nil])
end
+ def test_find_options_for_tagged_with_leavs_arguments_unchanged
+ original_tags = photos(:jonathan_questioning_dog).tags.dup
+ Photo.find_options_for_tagged_with(photos(:jonathan_questioning_dog).tags)
+ assert_equal original_tags, photos(:jonathan_questioning_dog).tags
+ end
+
def test_include_tags_on_find_tagged_with
assert_nothing_raised do
Photo.find_tagged_with('Nature', :include => :tags)

0 comments on commit 72fdf04

Please sign in to comment.