Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associations do not call .to_proc on Hash #25043

Merged
merged 1 commit into from
May 21, 2016

Conversation

tlrdstd
Copy link

@tlrdstd tlrdstd commented May 16, 2016

Summary

Don't call .to_proc on unsuspecting Hash objects that are intended to be ActiveRecord association configuration parameters.

Per #25010, Ruby 2.3 added to_proc on Hash objects. The ActiveRecord associations code checks received input to see if it responds to to_proc. In Ruby 2.2, Hash objects did not. In Ruby 2.3, they do. In these situations, calling to_proc leads to variously undefined results.

Other Information

These are the only suspect calls to to_proc in the Rails 3.2 codebase. However, other changes in Ruby 2.3 may or may not require other patches for perfect compatibility.

@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @rafaelfranca (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rails-bot
Copy link

warning Warning warning

  • Pull requests are usually filed against the master branch for this repo, but this one is against 3-2-stable. Please double check that you specified the right target!

@rafaelfranca rafaelfranca merged commit d4a1b33 into rails:3-2-stable May 21, 2016
@arthurnn
Copy link
Member

thanks

@flackou
Copy link

flackou commented May 25, 2016

👍 Thanks (had the same problem)

@andrewhoglund
Copy link

I am also having this problem, will point my code to 3-2-stable. Just curious, will this code only make it to a release if there is a subsequent security patches needed for 3.2?

@robin850
Copy link
Member

@ah-tunecore : Yep, you will have to stay on 3-2-stable until there's a security release.

@andrewhoglund
Copy link

@robin850 ok, thanks

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

Successfully merging this pull request may close these issues.

None yet

8 participants