diff options
author | Philip Arndt <parndt@gmail.com> | 2012-05-31 12:15:38 +1200 |
---|---|---|
committer | Philip Arndt <parndt@gmail.com> | 2012-05-31 12:22:54 +1200 |
commit | 4ce7f98c3b5bd16eb6c0b32ccd2ea51d72ddf825 (patch) | |
tree | de4a8baff08b48384c3631e5bc1ce9317aa8a593 /activerecord/lib | |
parent | b6727a1ed3ca35d4788f52f0bea49952a16cd41e (diff) | |
download | rails-4ce7f98c3b5bd16eb6c0b32ccd2ea51d72ddf825.tar.gz rails-4ce7f98c3b5bd16eb6c0b32ccd2ea51d72ddf825.tar.bz2 rails-4ce7f98c3b5bd16eb6c0b32ccd2ea51d72ddf825.zip |
Revert "Removes unneeded caching from ActiveRecord::Base.relation"
This reverts commit ebfa58abc895c0639211cb896a47b04e424322c8.
This change caused a regression in my application's tests:
* Failing build http://travis-ci.org/#!/resolve/refinerycms/builds/1461242
Broken tests pass after this change is reverted.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 2ac259d52d..c6f2102a5f 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -450,12 +450,12 @@ module ActiveRecord #:nodoc: private def relation #:nodoc: - relation ||= Relation.new(self, arel_table) + @relation ||= Relation.new(self, arel_table) if finder_needs_type_condition? - relation.where(type_condition).create_with(inheritance_column.to_sym => sti_name) + @relation.where(type_condition).create_with(inheritance_column.to_sym => sti_name) else - relation + @relation end end end @@ -489,6 +489,7 @@ module ActiveRecord #:nodoc: @marked_for_destruction = false @previously_changed = {} @changed_attributes = {} + @relation = nil ensure_proper_type |