Frage

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})
War es hilfreich?

Lösung

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 %>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top