ActiveSupport::MessageVerifier::InvalidSignature
chamnap opened this issue · comments
Currently, there is an issue when this exception is raised, it continues to render the actual view, and it breaks the app. It's because @options
is nil when called oped_out?
from the view.
It should halt the execution, however.
https://github.com/ankane/mailkick/blob/master/app/controllers/mailkick/subscriptions_controller.rb#L35
I see you already rescue this exception with the below code. However, it doesn't work for me on my rails app 5.1. (It works on rails 5.0.x)
render text: "Subscription not found", status: :bad_request
If I changed it to the below code, it works well.
render file: 'public/404.html', layout: false, status: 404
@ankane, Any thoughts?
Alright, I found it.
DEPRECATION WARNING:
render :text
is deprecated because it does not actually render atext/plain
response. Switch torender plain: 'plain text'
to render astext/plain
,render html: '<strong>HTML</strong>'
to render astext/html
, orrender body: 'raw'
to match the deprecated behavior and render with the default Content-Type, which istext/html
.
Changed it to the below, and it will fix the issue:
render plain: "Subscription not found", status: :bad_request
Would you like me to submit a PR? Doing a check with render :text
or render :plain
?
Hey @chamnap, thanks for reporting 👍 Fixed on master.