Have you tried this?
begin
...
rescue Exception => ex
@message = ex.message
render "error"
end
error is a view containing just a single line: error.html.erb
<%= @message %>
문제
I want to display the error message from any ActionView::Template::Error
in my views.
I have those error messages only in my terminal like:
ActionView::Template::Error (No route matches {:controller=>"transactions", :action=>"download", :id=>nil})
해결책
Have you tried this?
begin
...
rescue Exception => ex
@message = ex.message
render "error"
end
error is a view containing just a single line: error.html.erb
<%= @message %>