From 408fe5facc482f84194bbe79865a26b57b2cc883 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 31 May 2006 23:25:36 +0000 Subject: Added Array#to_s(:db) that'll produce a comma-separated list of ids [DHH] Split Grouping into its own file git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4387 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/base_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord') diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 4ccc2c8588..094d533a22 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -932,6 +932,14 @@ class BasicsTest < Test::Unit::TestCase assert_equal(41, c2.references) end + def test_quoting_arrays + replies = Reply.find(:all, :conditions => [ "id IN (?)", topics(:first).replies.to_s(:db) ]) + assert_equal topics(:first).replies.size, replies.size + + replies = Reply.find(:all, :conditions => [ "id IN (?)", [].to_s(:db) ]) + assert_equal 0, replies.size + end + MyObject = Struct.new :attribute1, :attribute2 def test_serialized_attribute -- cgit v1.2.3