aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/eager_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-02-11 22:22:19 +0000
committerJon Leighton <j@jonathanleighton.com>2011-02-14 01:40:31 +0000
commita7e19b30ca71f62af516675023659be061b2b70a (patch)
treef79f1347800952dff958dca5f34f1ce011e365ed /activerecord/test/cases/associations/eager_test.rb
parentfd7605826a6e4f7590e4abf42c6c9d0923afc4ef (diff)
downloadrails-a7e19b30ca71f62af516675023659be061b2b70a.tar.gz
rails-a7e19b30ca71f62af516675023659be061b2b70a.tar.bz2
rails-a7e19b30ca71f62af516675023659be061b2b70a.zip
Add interpolation of association conditions back in, in the form of proc { ... } rather than instance_eval-ing strings
Diffstat (limited to 'activerecord/test/cases/associations/eager_test.rb')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index 3074648d59..42dd612083 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -668,6 +668,14 @@ class EagerAssociationTest < ActiveRecord::TestCase
assert_equal people(:david, :susan), Person.find(:all, :include => [:readers, :primary_contact, :number1_fan], :conditions => "number1_fans_people.first_name like 'M%'", :order => 'people.id', :limit => 2, :offset => 0)
end
+ def test_preload_with_interpolation
+ post = Post.includes(:comments_with_interpolated_conditions).find(posts(:welcome).id)
+ assert_equal [comments(:greetings)], post.comments_with_interpolated_conditions
+
+ post = Post.joins(:comments_with_interpolated_conditions).find(posts(:welcome).id)
+ assert_equal [comments(:greetings)], post.comments_with_interpolated_conditions
+ end
+
def test_polymorphic_type_condition
post = Post.find(posts(:thinking).id, :include => :taggings)
assert post.taggings.include?(taggings(:thinking_general))