Skip to content

Instantly share code, notes, and snippets.

@MaryKuz
Created March 28, 2019 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaryKuz/e773d44dfff2a3b6e7208edf28e84e8d to your computer and use it in GitHub Desktop.
Save MaryKuz/e773d44dfff2a3b6e7208edf28e84e8d to your computer and use it in GitHub Desktop.
Catch error in ApplicationController
class ApplicationController < ActionController::Base
...
rescue_from ActiveRecord::RecordInvalid do
render :errors, status: :unprocessable_entity
end
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment