Add Finder API changes to upgrading guide #12015

Merged
merged 1 commit into from Aug 26, 2013

Conversation

Projects
None yet
5 participants
Member

vipulnsward commented Aug 25, 2013

Fixes #9894

guides/source/upgrading_ruby_on_rails.md
@@ -172,6 +172,16 @@ 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:
@robin850

robin850 Aug 26, 2013

Member

Could you please wrap these additions around 80 chars?

@vipulnsward

vipulnsward Aug 26, 2013

Member

I did so, since all other lines aren't.

@senny

senny Aug 26, 2013

Member

We are gradually moving to an 80 char limit on the guides. No reason to convert all at once but new stuff and changed stuff should be wrapped.

Member

vipulnsward commented Aug 26, 2013

steveklabnik added a commit that referenced this pull request Aug 26, 2013

Merge pull request #12015 from vipulnsward/add_dynamic_finders_to_upg…
…rade

Add Finder API changes to upgrading guide [ci skip]

@steveklabnik steveklabnik merged commit c9f834b into rails:master Aug 26, 2013

Contributor

garysweaver commented Aug 26, 2013

where(...) is not an equivalent to the old finders because it returns a relation, so there probably should be a statement below this section with something to the effect of, "Note that where(...) returns a relation, not an array like the old finders. In some cases, the resulting relation can be treated similarly to an array, but if you require an array, use where(...).to_a."

If being really picky, you might also want to include a statement that the SQL executed may not be exactly the same, depending on how it is used.

Feel free to disregard if you'd rather not make changes since it's committed.

Member

steveklabnik commented Aug 26, 2013

Sure, if you think this can be further improved, please submit a pull :)

Contributor

garysweaver commented Aug 26, 2013

Ok, cool. Just wanted to make sure it would be a good idea to clarify further.

steveklabnik added a commit that referenced this pull request Aug 27, 2013

Merge pull request #12015 from vipulnsward/add_dynamic_finders_to_upg…
…rade

Add Finder API changes to upgrading guide [ci skip]

@vipulnsward vipulnsward deleted the vipulnsward:add_dynamic_finders_to_upgrade branch Feb 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment