Remove monkey patches

#231
This commit is contained in:
Artur Beljajev 2017-08-04 15:57:59 +03:00
parent cee4c84edd
commit 2e827125b0
3 changed files with 0 additions and 59 deletions

View file

@ -1,20 +0,0 @@
# Log all active model user errors
# rubocop: disable Lint/AssignmentInCondition
# rubocop: disable Style/SignalException
module ActiveModel
class Errors
def add(attribute, message = :invalid, options = {})
message = normalize_message(attribute, message, options)
if exception = options[:strict]
exception = ActiveModel::StrictValidationFailed if exception == true
raise exception, full_message(attribute, message)
end
# CUSTOM logging
Rails.logger.info "USER MSG: ACTIVEMODEL: #{@base.try(:class)} [#{attribute}] #{message}" if message.present?
# END of CUSTOM logging
self[attribute] << message
end
end
end

View file

@ -1,8 +0,0 @@
# Log all user issues raised by active record
# rubocop: disable Metrics/LineLength
class ActiveRecord::Base
after_validation do |m|
Rails.logger.info "USER MSG: ACTIVERECORD: #{m.class} ##{m.id} #{m.errors.full_messages} #{m.errors['epp_errors']}" if m.errors.present?
true
end
end

View file

@ -1,31 +0,0 @@
# Log all flash messages
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/LineLength
module ActionDispatch
class Flash
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Style/MultilineOperationIndentation
def call(env)
@app.call(env)
ensure
session = Request::Session.find(env) || {}
flash_hash = env[KEY]
if flash_hash && (flash_hash.present? || session.key?('flash'))
session["flash"] = flash_hash.to_session_value
# EIS custom logging
Rails.logger.info "USER MSG: FLASH: #{session['flash']['flashes'].inspect}" if session['flash']
# END OF EIS custom logging
env[KEY] = flash_hash.dup
end
if (!session.respond_to?(:loaded?) || session.loaded?) && # (reset_session uses {}, which doesn't implement #loaded?)
session.key?('flash') && session['flash'].nil?
session.delete('flash')
end
end
end
end