This project is archived and is in readonly mode.
Optimize named_scope first and last to use LIMIT rather than loading the full collection
-
José Valim
- Tag changed from activerecord, performance to activerecord, patch, performance
It sounds great for me!
+1
-
Lars Klevan
Updated the docs for ActiveRecord#first and #last. Example for #first below.
A convenience wrapper for find(:first, *args). You can pass in all the
same arguments to this method as you can to find(:first) If the first
argument is an integer an array of the first n records will be returned.
#
==== Examples
#
Person.first # Equivalent to Person.find(:first)
Person.first(:conditions => [ "user_name = ?", user_name])
Person.first(5) # Equivalent to Person.find(:all, :limit => 5)
Person.first(5, :conditions => [ "user_name = ?", user_name])
-
Daniel Schierbeck
+1, simple and concise implementation.
-
Aditya Sanghi
Automatic cleanup of spam.
