mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Update documentation for default_scope
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
This commit is contained in:
parent
46c7dd2348
commit
c4023cbe20
1 changed files with 2 additions and 2 deletions
|
@ -2052,10 +2052,10 @@ module ActiveRecord #:nodoc:
|
|||
end
|
||||
|
||||
# Sets the default options for the model. The format of the
|
||||
# <tt>method_scoping</tt> argument is the same as in with_scope.
|
||||
# <tt>options</tt> argument is the same as in find.
|
||||
#
|
||||
# class Person < ActiveRecord::Base
|
||||
# default_scope :find => { :order => 'last_name, first_name' }
|
||||
# default_scope :order => 'last_name, first_name'
|
||||
# end
|
||||
def default_scope(options = {})
|
||||
self.default_scoping << { :find => options, :create => (options.is_a?(Hash) && options.has_key?(:conditions)) ? options[:conditions] : {} }
|
||||
|
|
Loading…
Reference in a new issue