We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 299c366 commit 545bb52Copy full SHA for 545bb52
1 file changed
app/controllers/application_controller.rb
@@ -19,6 +19,12 @@ class ApplicationController < ActionController::Base
19
rescue_from ActionController::RoutingError, with: :render_not_found
20
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
21
22
+ rescue_from ActiveRecord::RecordInvalid do |exception|
23
+ Rails.logger.error("Validation failed: #{exception.message}")
24
+ redirect_back(fallback_location: root_path,
25
+ alert: 'Unable to complete action. Please check your input and try again.')
26
+ end
27
+
28
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
29
rescue_from Pundit::AuthorizationNotPerformedError, with: :user_not_authorized
30
0 commit comments