aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-03-24 19:59:22 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-03-24 19:59:22 +0000
commitc6f2af5c31577e25c6f6b9f17be18858200a8e13 (patch)
tree4b5835b922381231aca10b5b1235d4a555a3af83 /activerecord/lib
parent081ddb6f24d70794ee9e071d3ed5302f52b26c4d (diff)
downloadrails-c6f2af5c31577e25c6f6b9f17be18858200a8e13.tar.gz
rails-c6f2af5c31577e25c6f6b9f17be18858200a8e13.tar.bz2
rails-c6f2af5c31577e25c6f6b9f17be18858200a8e13.zip
Added ActiveRecord#Base.all/first/last as aliases for find(:all/:first/:last) (closes #11413) [nkallen, thechrisoshow]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9085 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/base.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 9716473a4e..4f9fd71ffc 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -511,7 +511,19 @@ module ActiveRecord #:nodoc:
else find_from_ids(args, options)
end
end
+
+ # This is an alias for find(:first). You can pass in all the same arguments to this method as you can
+ # to find(:first)
+ def first(*args)
+ find(:first, *args)
+ end
+ # This is an alias for find(:last). You can pass in all the same arguments to this method as you can
+ # to find(:last)
+ def last(*args)
+ find(:last, *args)
+ end
+
#
# Executes a custom sql query against your database and returns all the results. The results will
# be returned as an array with columns requested encapsulated as attributes of the model you call