From 0e1d617b8b869426960ec25b62620fe1599cb5e6 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Mon, 18 Jul 2011 14:56:07 -0600 Subject: ActiveRecord: Fix eager loading so that giving a blank order clause generates valid SQL --- activerecord/test/cases/associations/eager_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activerecord/test/cases/associations') diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index f1d061133c..c6e451fc57 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -1048,4 +1048,16 @@ class EagerAssociationTest < ActiveRecord::TestCase assert_not_equal 0, post.comments.to_a.count end end + + def test_join_eager_with_empty_order_should_generate_valid_sql + assert_nothing_raised(ActiveRecord::StatementInvalid) do + Post.includes(:comments).order("").where(:comments => {:body => "Thank you for the welcome"}).first + end + end + + def test_join_eager_with_nil_order_should_generate_valid_sql + assert_nothing_raised(ActiveRecord::StatementInvalid) do + Post.includes(:comments).order(nil).where(:comments => {:body => "Thank you for the welcome"}).first + end + end end -- cgit v1.2.3