Remove deprecated passing string to define callback #27608

merged 2 commits into from Feb 7, 2017


None yet

3 participants

kamipo commented Jan 8, 2017

And raise ArgumentError when passing string to define callback.

@kamipo kamipo added the activesupport label Jan 8, 2017
- Passing string to define callback is deprecated and will be removed
- in Rails 5.1 without replacement.
+ raise ArgumentError, <<-MSG.squish
+ Passing string to define callback is not supported. Use proc instead.
kaspth Jan 8, 2017 Member

I'm not sure we should add this defensive coding. Presumably people have seen the deprecation warnings and acted on them.

kamipo Jan 8, 2017 Member

We still have string eval code for if and unless conditional options. Therefore passing string to define callback works again unless raising an error.

kaspth Jan 15, 2017 Member

@rafaelfranca @matthewd is the original deprecation warning obtuse enough that we could construe it to mean …also don't use strings in :if and :unless?

rafaelfranca Jan 18, 2017 Member

In that case we will have to deprecate it now since we didn't before. @kamipo could you also deprecate it in a new commit in this PR?

kamipo Jan 18, 2017 Member

Sure, will do.

kaspth commented Jan 8, 2017

@rafaelfranca since you removed most of the deprecations. r? @rafaelfranca


I should not merge this PR since deprecations removal should only be done by the release manager, but since this was not an easy one I'll merge it. But please don't open new PRs removing deprecation, better to open issues pointing ones that we forgot. I was aware of this one and was going to remove it with the return false callback deprecation.

kamipo commented Jan 18, 2017

Okay. BTW we still have another deprecation for deprecated_false_terminator. Do we remove the deprecation for Rails 5.1?

          def display_deprecation_warning_for_false_terminator
              Returning `false` in Active Record and Active Model callbacks will not implicitly halt a callback chain in Rails 5.1.
              To explicitly halt the callback chain, please use `throw :abort` instead.
kamipo commented Jan 19, 2017

I added the deprecation for :if and :unless options.

kamipo added some commits Jan 8, 2017
@kamipo kamipo Remove deprecated passing string to define callback
And raise `ArgumentError` when passing string to define callback.
@kamipo kamipo Deprecate passing string to `:if` and `:unless` conditional options o…
…n `set_callback` and `skip_callback`
@rafaelfranca rafaelfranca merged commit d7bbe07 into rails:master Feb 7, 2017

1 check passed

codeclimate no new or fixed issues
@kamipo kamipo deleted the kamipo:remove_deprecated_passing_string_to_define_callback branch Feb 7, 2017
@y-yagi y-yagi added a commit to y-yagi/rails that referenced this pull request Feb 18, 2017
@y-yagi y-yagi Remove deprecate passing string to `:if` and `:unless` conditional op…
…tions [ci skip]

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