The first thing is, we can have something like inline exception handlers.
rescue_from ActiveRecord::RecordNotFound do
render :file => ‘/bad_record’, :status => 404
end
Block can even take have an argument for exception object.
rescue_from ActiveRecord::RecordInvalid do |exception|
render :action => (exception.record.new_record? ? ‘new’ : ‘edit’)
end
The above method will be helpful if we use save! and create! in our RESTful application.
