diff options
author | miloops <miloops@gmail.com> | 2008-09-01 13:36:42 -0300 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-09-09 23:44:52 -0500 |
commit | 567392bff32acd5cf357565415d33c2662004cf5 (patch) | |
tree | 3b6df7201a8147fd621487721ab5b16bb15c62f1 /activerecord/lib/active_record/base.rb | |
parent | f3f7d166d8e7a1a2e15371f2870115406e1aaac2 (diff) | |
download | rails-567392bff32acd5cf357565415d33c2662004cf5.tar.gz rails-567392bff32acd5cf357565415d33c2662004cf5.tar.bz2 rails-567392bff32acd5cf357565415d33c2662004cf5.zip |
Added find_last_by dynamic finder [status:committed #762]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r--[-rwxr-xr-x] | activerecord/lib/active_record/base.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 907495a416..0fe9e12549 100755..100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -287,6 +287,7 @@ module ActiveRecord #:nodoc: # It's even possible to use all the additional parameters to find. For example, the full interface for <tt>Payment.find_all_by_amount</tt> # is actually <tt>Payment.find_all_by_amount(amount, options)</tt>. And the full interface to <tt>Person.find_by_user_name</tt> is # actually <tt>Person.find_by_user_name(user_name, options)</tt>. So you could call <tt>Payment.find_all_by_amount(50, :order => "created_on")</tt>. + # Also you may call <tt>Payment.find_last_by_amount(amount, options)</tt> returning the last record matching that amount and options. # # The same dynamic finder style can be used to create the object if it doesn't already exist. This dynamic finder is called with # <tt>find_or_create_by_</tt> and will return the object if it already exists and otherwise creates it, then returns it. Protected attributes won't be set unless they are given in a block. For example: |