Improved debugging info.
This commit is contained in:
parent
2730b8e4a2
commit
4d448dda8a
1 changed files with 13 additions and 14 deletions
|
@ -3,7 +3,7 @@ class HistoryObserver < ActiveRecord::Observer
|
|||
observe :ticket, :user, 'ticket::_article'
|
||||
|
||||
def after_create(record)
|
||||
puts 'HISTORY OBSERVER, object created !!!!' + record.class.name
|
||||
puts "HISTORY OBSERVER, object created #{ record.class.name }(#{ record.id })"
|
||||
# puts record.inspect
|
||||
related_o_id = nil
|
||||
related_history_object_id = nil
|
||||
|
@ -22,7 +22,7 @@ class HistoryObserver < ActiveRecord::Observer
|
|||
end
|
||||
|
||||
def before_update(record)
|
||||
puts 'before_update'
|
||||
# puts 'before_update'
|
||||
current = record.class.find(record.id)
|
||||
|
||||
# do not send anything if nothing has changed
|
||||
|
@ -30,7 +30,7 @@ class HistoryObserver < ActiveRecord::Observer
|
|||
return
|
||||
end
|
||||
|
||||
puts 'HISTORY OBSERVER object will be updated!!!!' + record.class.name
|
||||
puts "HISTORY OBSERVER object will be updated #{ record.class.name.to_s}(#{ current.id.to_s })"
|
||||
# puts 'current'
|
||||
# puts current.inspect
|
||||
# puts 'record'
|
||||
|
@ -38,8 +38,7 @@ class HistoryObserver < ActiveRecord::Observer
|
|||
|
||||
diff = differences_from?(current, record)
|
||||
puts ' DIFF'
|
||||
puts diff.inspect
|
||||
puts 'CURRENT O_ID ' + current.id.to_s
|
||||
puts ' ' + diff.inspect
|
||||
puts ' CURRENT USER ID ' + current_user_id.to_s
|
||||
|
||||
map = {
|
||||
|
@ -67,7 +66,7 @@ class HistoryObserver < ActiveRecord::Observer
|
|||
next if key.to_s == 'created_at'
|
||||
next if key.to_s == 'updated_at'
|
||||
|
||||
puts "#{key} is #{value_ids.inspect}"
|
||||
puts " CHANGED: #{key} is #{value_ids.inspect}"
|
||||
|
||||
# check if diff are ids, if yes do lookup
|
||||
if value_ids[0].to_s == value_ids[1].to_s
|
||||
|
|
Loading…
Reference in a new issue