aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
diff options
context:
space:
mode:
authorElliot Winkler <elliot.winkler@gmail.com>2011-07-18 14:56:07 -0600
committerElliot Winkler <elliot.winkler@gmail.com>2011-07-18 14:56:37 -0600
commit0e1d617b8b869426960ec25b62620fe1599cb5e6 (patch)
tree37878130e12ad19210d45239c4f4f1833c76a869 /activerecord/test/cases/associations
parentb475f74da5ec2ac4048f70d9063a1d4c0d63b546 (diff)
downloadrails-0e1d617b8b869426960ec25b62620fe1599cb5e6.tar.gz
rails-0e1d617b8b869426960ec25b62620fe1599cb5e6.tar.bz2
rails-0e1d617b8b869426960ec25b62620fe1599cb5e6.zip
ActiveRecord: Fix eager loading so that giving a blank order clause generates valid SQL
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb12
1 files changed, 12 insertions, 0 deletions
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