This project is archived and is in readonly mode.
Changeset [2e79ec71a542c2d2e7bedbe12eda0b5e177fb0e0] by Pratik Naik
Revision 2e79ec71a542c2d2e7bedbe12eda0b5e177fb0e0,
committed by Pratik Naik
· December 25th, 2009 @ 08:03 PM
Model.scoped now returns a relation if invoked without any arguments
Example :
posts = Post.scoped
posts.size # Fires "select count(*) from posts" and returns the count
posts.each {|p| puts p.name } # Fires "select * from posts" and loads post objects
http://github.com/rails/rails/commit/2e79ec71a542c2d2e7bedbe12eda0b...
2 changed files
-
M
activerecord/lib/active_record/named_scope.rb -
M
activerecord/test/cases/relations_test.rb