diff options
author | Jon Leighton <j@jonathanleighton.com> | 2013-03-15 13:46:39 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2013-03-15 13:48:45 +0000 |
commit | 133a1759a4c317e7836699bba2530603a84d7ccb (patch) | |
tree | ace4f14deaff55765ed4509066223032d9a7de43 /activerecord/test/cases | |
parent | 0721d3b37062eca73da3efd669142d7e381e4d80 (diff) | |
download | rails-133a1759a4c317e7836699bba2530603a84d7ccb.tar.gz rails-133a1759a4c317e7836699bba2530603a84d7ccb.tar.bz2 rails-133a1759a4c317e7836699bba2530603a84d7ccb.zip |
Cache the association proxy object
This reimplements the behaviour of Rails 3, as I couldn't see why we
shouldn't cache the object, and @alindeman had a good use case for
caching it:
https://github.com/rails/rails/commit/c86a32d7451c5d901620ac58630460915292f88b#commitcomment-2784312
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 41529cd050..a06bacafca 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -237,6 +237,11 @@ class AssociationProxyTest < ActiveRecord::TestCase assert david.projects.scope.is_a?(ActiveRecord::Relation) assert_equal david.projects, david.projects.scope end + + test "proxy object is cached" do + david = developers(:david) + assert david.projects.equal?(david.projects) + end end class OverridingAssociationsTest < ActiveRecord::TestCase |