Permalink
Browse files

Revert "Removes unneeded caching from ActiveRecord::Base.relation"

This reverts commit ebfa58a.

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.
  • Loading branch information...
1 parent b6727a1 commit 4ce7f98c3b5bd16eb6c0b32ccd2ea51d72ddf825 @parndt parndt committed May 31, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 activerecord/lib/active_record/base.rb
View
7 activerecord/lib/active_record/base.rb
@@ -450,12 +450,12 @@ def arel_engine
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 @@ def initialize(attributes = nil, options = {})
@marked_for_destruction = false
@previously_changed = {}
@changed_attributes = {}
+ @relation = nil
ensure_proper_type

0 comments on commit 4ce7f98

Please sign in to comment.