mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 08:22:05 +02:00
Revert "Registry 569"
This commit is contained in:
parent
9565f23e68
commit
4786dbb943
50 changed files with 323 additions and 2463 deletions
20
config/initializers/eis_custom_active_model.rb
Normal file
20
config/initializers/eis_custom_active_model.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
# 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
|
Loading…
Add table
Add a link
Reference in a new issue