1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Move PredicateBuilder instantiation to constructor

In order to maintain thread safety and prevent race condition from memoization.
This commit is contained in:
Melanie Gilman 2014-12-03 13:04:02 -05:00
parent 6613716ad7
commit 286ab9b606

View file

@ -26,6 +26,7 @@ module ActiveRecord
@values = values
@offsets = {}
@loaded = false
@predicate_builder = PredicateBuilder.new(klass, table)
end
def initialize_copy(other)
@ -632,6 +633,10 @@ module ActiveRecord
"#<#{self.class.name} [#{entries.join(', ')}]>"
end
protected
attr_reader :predicate_builder
private
def exec_queries
@ -677,9 +682,5 @@ module ActiveRecord
# ignore raw_sql_ that is used by Oracle adapter as alias for limit/offset subqueries
string.scan(/([a-zA-Z_][.\w]+).?\./).flatten.map(&:downcase).uniq - ['raw_sql_']
end
def predicate_builder
@predicate_builder ||= PredicateBuilder.new(klass, table)
end
end
end