Remove deprecated passing string to define callback #27608
Conversation
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. | ||
MSG | ||
end |
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.
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
Author
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.
https://github.com/rails/rails/blob/v5.0.1/activesupport/test/callbacks_test.rb#L197-L201
We still have string eval code for if
and unless
conditional options. Therefore passing string to define callback works again unless raising an error.
https://github.com/rails/rails/blob/v5.0.1/activesupport/test/callbacks_test.rb#L197-L201
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 @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?
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
Author
Member
Sure, will do.
Sure, will do.
@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. |
Okay. BTW we still have another deprecation for rails/activesupport/lib/active_support/callbacks.rb Lines 862 to 867 in ac387e8 def display_deprecation_warning_for_false_terminator
ActiveSupport::Deprecation.warn(<<-MSG.squish)
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.
MSG
end |
Yes, I'm working to remove this one.
…On Wed, Jan 18, 2017 at 9:37 AM Ryuta Kamizono ***@***.***> wrote:
Okay. BTW we still have another deprecation for
deprecated_false_terminator. Do we remove the deprecation for Rails 5.1?
https://github.com/rails/rails/blob/ac387e8e6d242204731ed9eff333ac491f15c55d/activesupport/lib/active_support/callbacks.rb#L862-L867
def display_deprecation_warning_for_false_terminator
ActiveSupport::Deprecation.warn(<<-MSG.squish) 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. MSG
end
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#27608 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAC66M7xoNd_eQLW7e6qW62eq0l9FLFBks5rTiOpgaJpZM4LdqQn>
.
|
I added the deprecation for |
And raise `ArgumentError` when passing string to define callback.
…n `set_callback` and `skip_callback`
0952552
…tions [ci skip] Follow up to rails#27608
And raise
ArgumentError
when passing string to define callback.