diff --git a/app/controllers/ticket_overviews_controller.rb b/app/controllers/ticket_overviews_controller.rb index bb65c3f53..5ec7048c2 100644 --- a/app/controllers/ticket_overviews_controller.rb +++ b/app/controllers/ticket_overviews_controller.rb @@ -376,7 +376,7 @@ class TicketOverviewsController < ApplicationController # load article ids # if item.history_object == 'Ticket' - tickets.push Ticket.find(item.o_id) + tickets.push Ticket.find( item['o_id'] ) # end # if item.history_object 'Ticket::Article' # tickets.push Ticket::Article.find(item.o_id) @@ -386,8 +386,8 @@ class TicketOverviewsController < ApplicationController # end # load users - if !users[item.created_by_id] - users[item.created_by_id] = user_data_full(item.created_by_id) + if !users[ item['created_by_id'] ] + users[ item['created_by_id'] ] = user_data_full( item['created_by_id'] ) end } @@ -411,7 +411,7 @@ class TicketOverviewsController < ApplicationController # load article ids # if item.history_object == 'Ticket' - tickets.push Ticket.find(item.o_id) + tickets.push Ticket.find( item['o_id'] ) # end # if item.history_object 'Ticket::Article' # tickets.push Ticket::Article.find(item.o_id) @@ -421,8 +421,8 @@ class TicketOverviewsController < ApplicationController # end # load users - if !users[item.created_by_id] - users[item.created_by_id] = user_data_full(item.created_by_id) + if !users[ item['created_by_id'] ] + users[ item['created_by_id'] ] = user_data_full( item['created_by_id'] ) end } diff --git a/app/models/history.rb b/app/models/history.rb index 9c52347d8..d95532c8f 100644 --- a/app/models/history.rb +++ b/app/models/history.rb @@ -25,12 +25,15 @@ class History < ActiveRecord::Base where( :history_type_id => History::Type.where( :name => ['created', 'updated']) ). order('created_at DESC, id DESC'). limit(10) + datas = [] stream.each do |item| - item['history_object'] = item.history_object - item['history_type'] = item.history_type + data = item.attributes + data['history_object'] = item.history_object + data['history_type'] = item.history_type + datas.push data # item['history_attribute'] = item.history_attribute end - return stream + return datas end def self.recent_viewed(user) @@ -40,12 +43,15 @@ class History < ActiveRecord::Base where( :history_type_id => History::Type.where( :name => ['viewed']) ). order('created_at DESC, id DESC'). limit(10) + datas = [] stream.each do |item| - item['history_object'] = item.history_object - item['history_type'] = item.history_type + data = item.attributes + data['history_object'] = item.history_object + data['history_type'] = item.history_type + datas.push data # item['history_attribute'] = item.history_attribute end - return stream + return datas end private