aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorTom Stuart <tom@experthuman.com>2008-11-17 20:10:59 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-11-17 22:00:14 +0100
commit32cb2345a54b9ab38461b2d4bb0dbd1706f2800e (patch)
tree9da1d7efd04f2f589c777699e2d3c6274820d4be /activerecord/lib/active_record/base.rb
parent3a33ee28e9babc5a1a78079f5ca50ea6249f2643 (diff)
downloadrails-32cb2345a54b9ab38461b2d4bb0dbd1706f2800e.tar.gz
rails-32cb2345a54b9ab38461b2d4bb0dbd1706f2800e.tar.bz2
rails-32cb2345a54b9ab38461b2d4bb0dbd1706f2800e.zip
Fix default_scope to work in combination with named scopes
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-xactiverecord/lib/active_record/base.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 68f44ef0f6..cff5fd7a42 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -2027,7 +2027,7 @@ module ActiveRecord #:nodoc:
# default_scope :find => { :order => 'last_name, first_name' }
# end
def default_scope(options = {})
- self.default_scoping << { :find => options, :create => options.is_a?(Hash) ? options[:conditions] : {} }
+ self.default_scoping << { :find => options, :create => (options.is_a?(Hash) && options.has_key?(:conditions)) ? options[:conditions] : {} }
end
# Test whether the given method and optional key are scoped.