Moved created_by_id and updated_by_id to application_model.rb as generic/transparent action. Params need not be used as arguments anymore.

This commit is contained in:
Martin Edenhofer 2013-04-20 10:55:33 +02:00
parent d2d321a1d4
commit 1f89e3f0cb

View file

@ -1,7 +1,6 @@
require 'history' require 'history'
class Observer::History < ActiveRecord::Observer class Observer::History < ActiveRecord::Observer
include UserInfo
observe :ticket, :user, 'ticket::_article' observe :ticket, :user, 'ticket::_article'
def after_create(record) def after_create(record)
@ -26,7 +25,7 @@ class Observer::History < ActiveRecord::Observer
:history_object => record.class.name, :history_object => record.class.name,
:related_o_id => related_o_id, :related_o_id => related_o_id,
:related_history_object => related_history_object, :related_history_object => related_history_object,
:created_by_id => current_user_id || record.created_by_id || 1 :created_by_id => record.created_by_id || UserInfo.current_user_id || 1
) )
end end
@ -50,7 +49,7 @@ class Observer::History < ActiveRecord::Observer
diff = differences_from?(current, record) diff = differences_from?(current, record)
puts ' DIFF' puts ' DIFF'
puts ' ' + diff.inspect puts ' ' + diff.inspect
puts ' CURRENT USER ID ' + current_user_id.to_s puts ' CURRENT USER ID ' + UserInfo.current_user_id.to_s
map = { map = {
:group_id => { :group_id => {
@ -155,7 +154,7 @@ class Observer::History < ActiveRecord::Observer
:value_to => value[1], :value_to => value[1],
:id_from => value_ids[0], :id_from => value_ids[0],
:id_to => value_ids[1], :id_to => value_ids[1],
:created_by_id => current_user_id || 1 || self['created_by_id'] || 1 :created_by_id => self['updated_by_id'] || UserInfo.current_user_id || 1
) )
end end