Displaying 1 result from an estimated 1 matches for "record_not_found".
2009 Feb 10
2
rescue_from for NoMethodError
Hi everyone,
I was just trying to catch some exceptions in my app,
for "Record Not Found" I used this
in my application.rb file
rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found
rescue_from ActionController::NoMethodError, :with => :show_error
private
def record_not_found
render :text => "404 Not Found", :status => 404
end
def show_error(exception)
render :text => exception.message;
end
and was quite successful but for "NoMe...