0

我想ActionView::Template::Error在我的视图中显示任何错误消息。

我的终端中只有这些错误消息,例如:

ActionView::Template::Error (No route matches {:controller=>"transactions", :action=>"download", :id=>nil})
4

1 回答 1

1

你试过这个吗?

begin
  ...
rescue Exception => ex
  @message = ex.message
  render "error"
end

error 是一个只包含一行的视图:error.html.erb

<%= @message %>
于 2013-04-11T20:49:02.253 回答