aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/upgrading_ruby_on_rails.md
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2013-08-25 14:23:28 +0530
committerVipul A M <vipulnsward@gmail.com>2013-08-26 23:34:54 +0530
commit186a9a17b035391eade2b4e0465f719fddadd5cc (patch)
tree9cfd640dc47f5119d7866b96f8eecaa48996c731 /guides/source/upgrading_ruby_on_rails.md
parent539180cf8edaa405928162644dc617b4c179edff (diff)
downloadrails-186a9a17b035391eade2b4e0465f719fddadd5cc.tar.gz
rails-186a9a17b035391eade2b4e0465f719fddadd5cc.tar.bz2
rails-186a9a17b035391eade2b4e0465f719fddadd5cc.zip
Add Finder API changes to upgrading guide [skip ci]
Diffstat (limited to 'guides/source/upgrading_ruby_on_rails.md')
-rw-r--r--guides/source/upgrading_ruby_on_rails.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index 391551938a..79e0c6bf09 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -172,6 +172,18 @@ this gem such as `whitelist_attributes` or `mass_assignment_sanitizer` options.
* Rails 4.0 has deprecated `ActiveRecord::Fixtures` in favor of `ActiveRecord::FixtureSet`.
* Rails 4.0 has deprecated `ActiveRecord::TestCase` in favor of `ActiveSupport::TestCase`.
+* Rails 4.0 has deprecated the old-style hash based finder API. This means that
+ methods which previously accepted "finder options" no longer do.
+
+* All dynamic methods except for `find_by_...` and `find_by_...!` are deprecated.
+ Here's how you can handle the changes:
+
+ * `find_all_by_...` becomes `where(...)`.
+ * `find_last_by_...` becomes `where(...).last`.
+ * `scoped_by_...` becomes `where(...)`.
+ * `find_or_initialize_by_...` becomes `find_or_initialize_by(...)`.
+ * `find_or_create_by_...` becomes `find_or_create_by(...)`.
+
### Active Resource
Rails 4.0 extracted Active Resource to its own gem. If you still need the feature you can add the [Active Resource gem](https://github.com/rails/activeresource) in your Gemfile.