문제

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 %>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top