Permalink
Browse files

Query objects if readonly_value is false, skip them only if nil.

  • Loading branch information...
miloops committed Oct 20, 2010
1 parent 024bc70 commit b9e869a420d0ae0a94446df012c215aefa58487b
Showing with 3 additions and 3 deletions.
  1. +3 −3 activerecord/lib/active_record/relation.rb
@@ -61,12 +61,12 @@ def respond_to?(method, include_private = false)
def to_a
return @records if loaded?
- @records = if @readonly_value
+ @records = if @readonly_value.nil?
+ eager_loading? ? find_with_associations : @klass.find_by_sql(arel.to_sql, @bind_values)
+ else
IdentityMap.without do
eager_loading? ? find_with_associations : @klass.find_by_sql(arel.to_sql, @bind_values)
end
- else
- eager_loading? ? find_with_associations : @klass.find_by_sql(arel.to_sql, @bind_values)
end
preload = @preload_values

0 comments on commit b9e869a

Please sign in to comment.