提交 a3210d90 编写于 作者: E Emilio Tagua

implicit_readonly is not set until records are loaded, just check...

implicit_readonly is not set until records are loaded, just check readonly_value and then set readonly status.
上级 c0ad5e48
......@@ -61,9 +61,7 @@ def respond_to?(method, include_private = false)
def to_a
return @records if loaded?
readonly = @readonly_value.nil? ? @implicit_readonly : @readonly_value
@records = if readonly
@records = if @readonly_value
IdentityMap.without do
eager_loading? ? find_with_associations : @klass.find_by_sql(arel.to_sql, @bind_values)
end
......@@ -77,6 +75,7 @@ def to_a
# @readonly_value is true only if set explicitly. @implicit_readonly is true if there
# are JOINS and no explicit SELECT.
readonly = @readonly_value.nil? ? @implicit_readonly : @readonly_value
@records.each { |record| record.readonly! } if readonly
@loaded = true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册