aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xactiverecord/lib/active_record/base.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index b922b869bd..4dfd4a26b1 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1631,8 +1631,8 @@ module ActiveRecord #:nodoc:
# Inherit :readonly from finder scope if set. Otherwise,
# if :joins is not blank then :readonly defaults to true.
unless options.has_key?(:readonly)
- if scoped?(:find, :readonly)
- options[:readonly] = scope(:find, :readonly)
+ if scoped_readonly = scope(:find, :readonly)
+ options[:readonly] = scoped_readonly
elsif !options[:joins].blank? && !options[:select]
options[:readonly] = true
end