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'
|
observe :ticket, :user, 'ticket::_article'
|
||||||
|
|
||||||
def after_create(record)
|
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
|
# puts record.inspect
|
||||||
related_o_id = nil
|
related_o_id = nil
|
||||||
related_history_object_id = nil
|
related_history_object_id = nil
|
||||||
|
@ -22,7 +22,7 @@ class HistoryObserver < ActiveRecord::Observer
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_update(record)
|
def before_update(record)
|
||||||
puts 'before_update'
|
# puts 'before_update'
|
||||||
current = record.class.find(record.id)
|
current = record.class.find(record.id)
|
||||||
|
|
||||||
# do not send anything if nothing has changed
|
# do not send anything if nothing has changed
|
||||||
|
@ -30,17 +30,16 @@ class HistoryObserver < ActiveRecord::Observer
|
||||||
return
|
return
|
||||||
end
|
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'
|
||||||
# puts current.inspect
|
# puts current.inspect
|
||||||
# puts 'record'
|
# puts 'record'
|
||||||
# puts record.inspect
|
# puts record.inspect
|
||||||
|
|
||||||
diff = differences_from?(current, record)
|
diff = differences_from?(current, record)
|
||||||
puts 'DIFF'
|
puts ' DIFF'
|
||||||
puts diff.inspect
|
puts ' ' + diff.inspect
|
||||||
puts 'CURRENT O_ID ' + current.id.to_s
|
puts ' CURRENT USER ID ' + current_user_id.to_s
|
||||||
puts 'CURRENT USER ID ' + current_user_id.to_s
|
|
||||||
|
|
||||||
map = {
|
map = {
|
||||||
:group_id => {
|
:group_id => {
|
||||||
|
@ -67,7 +66,7 @@ class HistoryObserver < ActiveRecord::Observer
|
||||||
next if key.to_s == 'created_at'
|
next if key.to_s == 'created_at'
|
||||||
next if key.to_s == 'updated_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
|
# check if diff are ids, if yes do lookup
|
||||||
if value_ids[0].to_s == value_ids[1].to_s
|
if value_ids[0].to_s == value_ids[1].to_s
|
||||||
|
|
Loading…
Reference in a new issue