aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_record_querying.md
diff options
context:
space:
mode:
authorJonathan Roes <jroes@jroes.net>2013-04-23 00:02:24 -0300
committerJonathan Roes <jroes@jroes.net>2013-04-23 00:02:24 -0300
commit099f1176c055bf213b41fe61e46c01b10072698a (patch)
tree75ba80e3bf6fb9400a45a91a8c63c10c89071ecb /guides/source/active_record_querying.md
parent0eae24a1a649f7cce88af609555801e506b19a3e (diff)
downloadrails-099f1176c055bf213b41fe61e46c01b10072698a.tar.gz
rails-099f1176c055bf213b41fe61e46c01b10072698a.tar.bz2
rails-099f1176c055bf213b41fe61e46c01b10072698a.zip
Mention that Dynamic finders have been deprecated in Rails 4
Diffstat (limited to 'guides/source/active_record_querying.md')
-rw-r--r--guides/source/active_record_querying.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index e1d9f39c3e..e55810bebb 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -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 https://github.com/rails/activerecord-deprecated_finders
+
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")`