I handle RecordNotFound error in my application_controller.rb as follow:
rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found
private
def record_not_found
flash[:error] = "Oops, we cannot find this record"
redirect_to :back
end
But I would like to get more information, such as class/table name of which record was not found.
How should I go about it?
Thank you.
Say for example,
UPDATE
Now in your
config/locales/en.yml(this would help translate, refer to i18n here)If you do not want to use locales just put up this information in
flash[:notice]itself.More dynamic ?
Write a function and use the same flash [:notice] there. Wont hurt at all.
want more data ?
Heres a quick solution, i always
<%= params%>in my views to know easily whats going and whats coming. You can then open your rails console and play along with different actions and so on.All of this is good enough data, i think.
Good luck.