dev_forum
p31729568 6 years ago
parent 5e83c0b8f4
commit cf653740ba

@ -1,6 +1,5 @@
class AccountsController < ApplicationController class AccountsController < ApplicationController
include ErrorCommon
#skip_before_action :check_account, :only => [:logout] #skip_before_action :check_account, :only => [:logout]
def index def index

@ -5,7 +5,6 @@ class AttachmentsController < ApplicationController
before_action :require_login, :check_auth before_action :require_login, :check_auth
before_action :find_file, only: %i[show destroy] before_action :find_file, only: %i[show destroy]
include ErrorCommon
include ApplicationHelper include ApplicationHelper
def show def show

@ -15,5 +15,9 @@ module ControllerRescueHandler
rescue_from ActiveRecord::RecordInvalid do |ex| rescue_from ActiveRecord::RecordInvalid do |ex|
render_error(ex.record.errors.full_messages.join(',')) render_error(ex.record.errors.full_messages.join(','))
end end
rescue_from Exception do |e|
logger.error e
render json: {status: -1, message: e.message}
end
end end
end end

@ -1,10 +0,0 @@
module ErrorCommon
extend ActiveSupport::Concern
included do
rescue_from Exception do |e|
logger.error e
render json: {status: -1, message: e.message}
end
end
end

@ -21,8 +21,8 @@ module Searchable::Shixun
def searchable_user_data def searchable_user_data
{ {
author_name: user.real_name, author_name: user&.real_name,
author_school_name: user.school_name, author_school_name: user&.school_name,
} }
end end

Loading…
Cancel
Save