This project is archived and is in readonly mode.
named_scope :all is missing
-
Craig Buchek
Duh, don't need the lambda in the definition of the named_scope. This should suffice:
named_scope :all, :conditions => {} -
Zack Hobson
I like this idea as well, but this would change the current semantics of ActiveRecord::Base.all. Also, ActiveRecord has default_scope, which may cause confusion about whether you're supposed to redefine all or use default_scope when you want uniform behaviour from your finders.
Perhaps the documentation should be updated instead to indicate that all is not a named_scope, and also provide a pointer to default_scope before users can get any clever ideas.
On reflection, I don't think the functionality needs to change, just the documentation. It's an appealing idea (evidently whoever wrote the docs thought so too) but there's no big win to be achieved by changing the existing semantics.
-
Zack Hobson
- Tag changed from activerecord, edge, named_scope to activerecord, edge, named_scope, patch
Here's a patch that updates the documentation so it no longer indicates that all is a named_scope. I also added a (helpful?) pointer to default_scope.
-
Repository
- State changed from new to committed
(from [ff894b55dd787af1d6284567f2a898090aae64ca]) Update rdoc: all is not a named_scope [#1959 named_scope :all is missing state:committed]
Signed-off-by: David Heinemeier Hansson david@loudthinking.com http://github.com/rails/rails/co...
