Browse files

Mention that Dynamic finders have been deprecated in Rails 4

  • Loading branch information...
1 parent 0eae24a commit 099f1176c055bf213b41fe61e46c01b10072698a @jroes jroes committed Apr 23, 2013
Showing with 2 additions and 0 deletions.
  1. +2 −0 guides/source/
2 guides/source/
@@ -1301,6 +1301,8 @@ Client.unscoped {
Dynamic Finders
+NOTE: Dynamic finders have been deprecated in Rails 4.0 and will be removed in Rails 4.1. The best practice is to use ActiveRecord scopes instead. You can find the deprecation gem at
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.
You can specify an exclamation point (`!`) on the end of the dynamic finders to get them to raise an `ActiveRecord::RecordNotFound` error if they do not return any records, like `Client.find_by_name!("Ryan")`

0 comments on commit 099f117

Please sign in to comment.