class method
self.default_scope
Ruby on Rails 2.3.18
Since v2.3.18 Last seen in v3.1.12Signature
self.default_scope(options = {})
Sets the default options for the model. The format of the options argument is the same as in find.
class Person < ActiveRecord::Base default_scope :order => 'last_name, first_name' end
Parameters
-
optionsopt = {}
Source
# File activerecord/lib/active_record/base.rb, line 2208
def default_scope(options = {})
self.default_scoping << { :find => options, :create => options[:conditions].is_a?(Hash) ? options[:conditions] : {} }
end
Defined in activerecord/lib/active_record/base.rb line 2208
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Base