diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-04-26 19:32:49 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-04-26 19:45:55 -0700 |
commit | e06f68fdb2132623d27a26ae58213b09ecb308ee (patch) | |
tree | 17231cded4b5ec956b73fce744b5771cf28c26af /actionmailer/lib/action_mailer/preview.rb | |
parent | f52cdaac6336f99d13622ff9bda556a3124a4121 (diff) | |
download | rails-e06f68fdb2132623d27a26ae58213b09ecb308ee.tar.gz rails-e06f68fdb2132623d27a26ae58213b09ecb308ee.tar.bz2 rails-e06f68fdb2132623d27a26ae58213b09ecb308ee.zip |
Do not try to encoding the parameters when the controller is not defined
When you have a route that points to an nonexistent controller we raise
an exception.
This exception was being caught by the DebugExceptions middleware in
development, but when trying to render the error page, we are reading
the request format[[1][]]. To determine the request format we are reading
the format parameters[[2][]], and to be able to read the parameters we need
to encode them[[3][]]. This was raising another exception that to encode the
parameter we try to load the controller to determine if we need to
encode the parameters are binary[[4][]]. This new exception inside the
DebugExceptions middleware makes Rails to render a generic error page.
To avoid this new exception now we only encode the parameters when the
controller can be loaded.
Fixes #28892
[1]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb#L80
[2]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/http/mime_negotiation.rb#L63
[3]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/http/parameters.rb#L58
[4]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/http/parameters.rb#L88
Diffstat (limited to 'actionmailer/lib/action_mailer/preview.rb')
0 files changed, 0 insertions, 0 deletions