Skip to content
This repository
Browse code

find_all_by is deprecated in AR 4

  • Loading branch information...
commit ad8275396ae6d76a6556e0f42d91e0a6dc42f4c8 1 parent 545ee23
Akira Matsuda authored January 02, 2013
9  activerecord/lib/active_record/base.rb
@@ -162,12 +162,9 @@ module ActiveRecord #:nodoc:
162 162
   #
163 163
   # Dynamic attribute-based finders are a cleaner way of getting (and/or creating) objects
164 164
   # by simple queries without turning to SQL. They work by appending the name of an attribute
165  
-  # to <tt>find_by_</tt>, <tt>find_last_by_</tt>, or <tt>find_all_by_</tt> and thus produces finders
166  
-  # like <tt>Person.find_by_user_name</tt>, <tt>Person.find_all_by_last_name</tt>, and
167  
-  # <tt>Payment.find_by_transaction_id</tt>. Instead of writing
  165
+  # to <tt>find_by_</tt>, or <tt>find_last_by_</tt> and thus produces finders
  166
+  # like <tt>Person.find_by_user_name</tt>, and # <tt>Payment.find_by_transaction_id</tt>. Instead of writing
168 167
   # <tt>Person.where(user_name: user_name).first</tt>, you just do <tt>Person.find_by_user_name(user_name)</tt>.
169  
-  # And instead of writing <tt>Person.where(last_name: last_name).all</tt>, you just do
170  
-  # <tt>Person.find_all_by_last_name(last_name)</tt>.
171 168
   #
172 169
   # It's possible to add an exclamation point (!) on the end of the dynamic finders to get them to raise an
173 170
   # <tt>ActiveRecord::RecordNotFound</tt> error if they do not return any records,
@@ -180,7 +177,7 @@ module ActiveRecord #:nodoc:
180 177
   #
181 178
   # It's even possible to call these dynamic finder methods on relations and named scopes.
182 179
   #
183  
-  #   Payment.order("created_on").find_all_by_amount(50)
  180
+  #   Payment.order("created_on").find_by_amount(50)
184 181
   #   Payment.pending.find_last_by_amount(100)
185 182
   #
186 183
   # The same dynamic finder style can be used to create the object if it doesn't already exist.
3  guides/source/active_record_callbacks.md
Source Rendered
@@ -168,7 +168,6 @@ Additionally, the `after_find` callback is triggered by the following finder met
168 168
 * `all`
169 169
 * `first`
170 170
 * `find`
171  
-* `find_all_by_*`
172 171
 * `find_by_*`
173 172
 * `find_by_*!`
174 173
 * `find_by_sql`
@@ -176,7 +175,7 @@ Additionally, the `after_find` callback is triggered by the following finder met
176 175
 
177 176
 The `after_initialize` callback is triggered every time a new object of the class is initialized.
178 177
 
179  
-NOTE: The `find_all_by_*`, `find_by_*` and `find_by_*!` methods are dynamic finders generated automatically for every attribute. Learn more about them at the [Dynamic finders section](active_record_querying.html#dynamic-finders)
  178
+NOTE: The `find_by_*` and `find_by_*!` methods are dynamic finders generated automatically for every attribute. Learn more about them at the [Dynamic finders section](active_record_querying.html#dynamic-finders)
180 179
 
181 180
 Skipping Callbacks
182 181
 ------------------
2  guides/source/active_record_querying.md
Source Rendered
@@ -1228,7 +1228,7 @@ Client.unscoped {
1228 1228
 Dynamic Finders
1229 1229
 ---------------
1230 1230
 
1231  
-For every field (also known as an attribute) you define in your table, Active Record provides a finder method. If you have a field called `first_name` on your `Client` model for example, you get `find_by_first_name` and `find_all_by_first_name` for free from Active Record. If you have a `locked` field on the `Client` model, you also get `find_by_locked` and `find_all_by_locked` methods.
  1231
+For every field (also known as an attribute) you define in your table, Active Record provides a finder method. If you have a field called `first_name` on your `Client` model for example, you get `find_by_first_name` for free from Active Record. If you have a `locked` field on the `Client` model, you also get `find_by_locked` and methods.
1232 1232
 
1233 1233
 You can also use `find_last_by_*` methods which will find the last record matching your argument.
1234 1234
 

0 notes on commit ad82753

Please sign in to comment.
Something went wrong with that request. Please try again.