From 508d24af2c8f350f2c99fe0376f7d9415071cc22 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 6 Jul 2019 10:10:24 +0800 Subject: [PATCH] fix trial apply --- app/controllers/concerns/controller_rescue_handler.rb | 3 +++ app/controllers/ecs/base_controller.rb | 9 --------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/controllers/concerns/controller_rescue_handler.rb b/app/controllers/concerns/controller_rescue_handler.rb index e9563d1e5..31934db03 100644 --- a/app/controllers/concerns/controller_rescue_handler.rb +++ b/app/controllers/concerns/controller_rescue_handler.rb @@ -12,5 +12,8 @@ module ControllerRescueHandler rescue_from ActiveModel::ValidationError do |ex| render_error(ex.model.errors.full_messages.join(',')) end + rescue_from ActiveRecord::RecordInvalid do |ex| + render_error(ex.record.errors.full_messages.join(',')) + end end end \ No newline at end of file diff --git a/app/controllers/ecs/base_controller.rb b/app/controllers/ecs/base_controller.rb index ad11682c3..9fb99c420 100644 --- a/app/controllers/ecs/base_controller.rb +++ b/app/controllers/ecs/base_controller.rb @@ -1,14 +1,5 @@ class Ecs::BaseController < ApplicationController - # model validation error - rescue_from ActiveRecord::RecordInvalid do |ex| - render_error(ex.record.errors.full_messages.join(',')) - end - # form validation error - rescue_from ActiveModel::ValidationError do |ex| - render_error(ex.model.errors.full_messages.join(',')) - end - before_action :require_login before_action :check_user_permission!