aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-02-11 02:50:58 +0000
committerMichael Koziarski <michael@koziarski.com>2008-02-11 02:50:58 +0000
commitd4daf7bba7dda756ab4700016e9b4b31f6127a1e (patch)
treee8b3be3a047e66b17584f7dd14db7351ccbae904 /activerecord/test/cases/associations
parentc9402b2277b18e65064720cc9ebf272a321de1ff (diff)
downloadrails-d4daf7bba7dda756ab4700016e9b4b31f6127a1e.tar.gz
rails-d4daf7bba7dda756ab4700016e9b4b31f6127a1e.tar.bz2
rails-d4daf7bba7dda756ab4700016e9b4b31f6127a1e.zip
Fix eager loading with pre-quoted table names. Closes #11046 [danielmorrison, Koz, Jeremy Kemper]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8856 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index b606092d7e..c95099c146 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -119,6 +119,30 @@ class EagerAssociationTest < ActiveRecord::TestCase
assert_equal [6,7,8], comments.collect { |c| c.id }
end
+ def test_eager_association_loading_with_belongs_to_and_conditions_string_with_unquoted_table_name
+ assert_nothing_raised do
+ Comment.find(:all, :include => :post, :conditions => ['posts.id = ?',4])
+ end
+ end
+
+ def test_eager_association_loading_with_belongs_to_and_conditions_string_with_quoted_table_name
+ assert_nothing_raised do
+ Comment.find(:all, :include => :post, :conditions => ["#{Comment.connection.quote_table_name('posts.id')} = ?",4])
+ end
+ end
+
+ def test_eager_association_loading_with_belongs_to_and_order_string_with_unquoted_table_name
+ assert_nothing_raised do
+ Comment.find(:all, :include => :post, :order => 'posts.id')
+ end
+ end
+
+ def test_eager_association_loading_with_belongs_to_and_order_string_with_quoted_table_name
+ assert_nothing_raised do
+ Comment.find(:all, :include => :post, :order => Comment.connection.quote_table_name('posts.id'))
+ end
+ end
+
def test_eager_association_loading_with_belongs_to_and_limit_and_multiple_associations
posts = Post.find(:all, :include => [:author, :very_special_comment], :limit => 1, :order => 'posts.id')
assert_equal 1, posts.length