mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Log all activerecord and activemodel user issues #2808
This commit is contained in:
parent
09deb2b187
commit
dd7771c59d
5 changed files with 26 additions and 2 deletions
|
@ -134,7 +134,6 @@ class Epp::Domain < Domain
|
||||||
at[:reserved_pw] = frame.css('reserved > pw').text
|
at[:reserved_pw] = frame.css('reserved > pw').text
|
||||||
|
|
||||||
# at[:statuses] = domain_statuses_attrs(frame, action)
|
# at[:statuses] = domain_statuses_attrs(frame, action)
|
||||||
# binding.pry
|
|
||||||
at[:nameservers_attributes] = nameservers_attrs(frame, action)
|
at[:nameservers_attributes] = nameservers_attrs(frame, action)
|
||||||
at[:admin_domain_contacts_attributes] = admin_domain_contacts_attrs(frame, action)
|
at[:admin_domain_contacts_attributes] = admin_domain_contacts_attrs(frame, action)
|
||||||
at[:tech_domain_contacts_attributes] = tech_domain_contacts_attrs(frame, action)
|
at[:tech_domain_contacts_attributes] = tech_domain_contacts_attrs(frame, action)
|
||||||
|
|
18
config/initializers/eis_custom_active_model.rb
Normal file
18
config/initializers/eis_custom_active_model.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Log all active model user errors
|
||||||
|
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: #{Time.now.to_s(:db)} ACTIVEMODEL: #{@base.try(:class)} [#{attribute}] #{message}" if message.present?
|
||||||
|
# END of CUSTOM logging
|
||||||
|
|
||||||
|
self[attribute] << message
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
7
config/initializers/eis_custom_active_record.rb
Normal file
7
config/initializers/eis_custom_active_record.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Log all user issues raised by active record
|
||||||
|
class ActiveRecord::Base
|
||||||
|
after_validation do |m|
|
||||||
|
Rails.logger.info "USER MSG: #{Time.now.to_s(:db)} ACTIVERECORD: #{m.class} ##{m.id} #{m.errors.full_messages} #{m.errors['epp_errors']}" if m.errors.present?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,3 +1,4 @@
|
||||||
|
# Log all flash messages
|
||||||
module ActionDispatch
|
module ActionDispatch
|
||||||
class Flash
|
class Flash
|
||||||
def call(env)
|
def call(env)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
worker_processes 2
|
worker_processes 2
|
||||||
|
|
||||||
# after_fork do |server, worker|
|
# after_fork do |server, worker|
|
||||||
# binding.pry
|
|
||||||
# ActiveRecord::Base.establish_connection
|
# ActiveRecord::Base.establish_connection
|
||||||
|
|
||||||
# Que.mode = :async
|
# Que.mode = :async
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue