1
0
Fork 0
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:
Daniel Luz 2008-12-01 02:58:39 -02:00 committed by David Heinemeier Hansson
parent 46c7dd2348
commit c4023cbe20

View file

@ -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] : {} }