diff options
author | Anthony Crumley <anthony.crumley@gmail.com> | 2009-05-04 09:49:43 -0500 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-05-10 13:36:51 +1200 |
commit | 026b78f9076216990bddb1aa5d83d23a647c02a5 (patch) | |
tree | 70cdf5bc99af0613d64effc892b0969d461aba43 /activerecord/test | |
parent | 9e0cfdb7f951c0446cdfd3b2cc26443712fe657a (diff) | |
download | rails-026b78f9076216990bddb1aa5d83d23a647c02a5.tar.gz rails-026b78f9076216990bddb1aa5d83d23a647c02a5.tar.bz2 rails-026b78f9076216990bddb1aa5d83d23a647c02a5.zip |
Fixed eager load error on find with include => [:table_name] and hash conditions like {:table_name => {:column => 'value'}}
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 12 |
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 40723814c5..d23f86b700 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -223,6 +223,18 @@ class EagerAssociationTest < ActiveRecord::TestCase end end + def test_eager_association_loading_with_belongs_to_and_conditions_hash + comments = [] + assert_nothing_raised do + comments = Comment.find(:all, :include => :post, :conditions => {:posts => {:id => 4}}, :limit => 3, :order => 'comments.id') + end + assert_equal 3, comments.length + assert_equal [5,6,7], comments.collect { |c| c.id } + assert_no_queries do + comments.first.post + end + end + def test_eager_association_loading_with_belongs_to_and_conditions_string_with_quoted_table_name quoted_posts_id= Comment.connection.quote_table_name('posts') + '.' + Comment.connection.quote_column_name('id') assert_nothing_raised do |