diff options
author | Akira Matsuda <ronnie@dio.jp> | 2013-01-02 04:36:33 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2013-01-02 04:42:34 +0900 |
commit | ad8275396ae6d76a6556e0f42d91e0a6dc42f4c8 (patch) | |
tree | 7da3ca01ba74a645b1d4737a6005414e01b96cf2 /activerecord | |
parent | 545ee23f0a1e54b739b8b59cdc20e458b03c743f (diff) | |
download | rails-ad8275396ae6d76a6556e0f42d91e0a6dc42f4c8.tar.gz rails-ad8275396ae6d76a6556e0f42d91e0a6dc42f4c8.tar.bz2 rails-ad8275396ae6d76a6556e0f42d91e0a6dc42f4c8.zip |
find_all_by is deprecated in AR 4
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 13424e621c..8285261e3e 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -162,12 +162,9 @@ module ActiveRecord #:nodoc: # # Dynamic attribute-based finders are a cleaner way of getting (and/or creating) objects # by simple queries without turning to SQL. They work by appending the name of an attribute - # to <tt>find_by_</tt>, <tt>find_last_by_</tt>, or <tt>find_all_by_</tt> and thus produces finders - # like <tt>Person.find_by_user_name</tt>, <tt>Person.find_all_by_last_name</tt>, and - # <tt>Payment.find_by_transaction_id</tt>. Instead of writing + # to <tt>find_by_</tt>, or <tt>find_last_by_</tt> and thus produces finders + # like <tt>Person.find_by_user_name</tt>, and # <tt>Payment.find_by_transaction_id</tt>. Instead of writing # <tt>Person.where(user_name: user_name).first</tt>, you just do <tt>Person.find_by_user_name(user_name)</tt>. - # And instead of writing <tt>Person.where(last_name: last_name).all</tt>, you just do - # <tt>Person.find_all_by_last_name(last_name)</tt>. # # It's possible to add an exclamation point (!) on the end of the dynamic finders to get them to raise an # <tt>ActiveRecord::RecordNotFound</tt> error if they do not return any records, @@ -180,7 +177,7 @@ module ActiveRecord #:nodoc: # # It's even possible to call these dynamic finder methods on relations and named scopes. # - # Payment.order("created_on").find_all_by_amount(50) + # Payment.order("created_on").find_by_amount(50) # Payment.pending.find_last_by_amount(100) # # The same dynamic finder style can be used to create the object if it doesn't already exist. |