提交 c942eccf 编写于 作者: D Daniel Luz

Update documentation for default_scope

上级 0f7207ff
......@@ -2052,10 +2052,10 @@ def subclasses #: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] : {} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册