Fixed warnings.

This commit is contained in:
Martin Edenhofer 2012-04-20 14:25:13 +02:00
parent 0d26851a5e
commit 575fb17964
2 changed files with 18 additions and 12 deletions

View file

@ -376,7 +376,7 @@ class TicketOverviewsController < ApplicationController
# load article ids # load article ids
# if item.history_object == 'Ticket' # if item.history_object == 'Ticket'
tickets.push Ticket.find(item.o_id) tickets.push Ticket.find( item['o_id'] )
# end # end
# if item.history_object 'Ticket::Article' # if item.history_object 'Ticket::Article'
# tickets.push Ticket::Article.find(item.o_id) # tickets.push Ticket::Article.find(item.o_id)
@ -386,8 +386,8 @@ class TicketOverviewsController < ApplicationController
# end # end
# load users # load users
if !users[item.created_by_id] if !users[ item['created_by_id'] ]
users[item.created_by_id] = user_data_full(item.created_by_id) users[ item['created_by_id'] ] = user_data_full( item['created_by_id'] )
end end
} }
@ -411,7 +411,7 @@ class TicketOverviewsController < ApplicationController
# load article ids # load article ids
# if item.history_object == 'Ticket' # if item.history_object == 'Ticket'
tickets.push Ticket.find(item.o_id) tickets.push Ticket.find( item['o_id'] )
# end # end
# if item.history_object 'Ticket::Article' # if item.history_object 'Ticket::Article'
# tickets.push Ticket::Article.find(item.o_id) # tickets.push Ticket::Article.find(item.o_id)
@ -421,8 +421,8 @@ class TicketOverviewsController < ApplicationController
# end # end
# load users # load users
if !users[item.created_by_id] if !users[ item['created_by_id'] ]
users[item.created_by_id] = user_data_full(item.created_by_id) users[ item['created_by_id'] ] = user_data_full( item['created_by_id'] )
end end
} }

View file

@ -25,12 +25,15 @@ class History < ActiveRecord::Base
where( :history_type_id => History::Type.where( :name => ['created', 'updated']) ). where( :history_type_id => History::Type.where( :name => ['created', 'updated']) ).
order('created_at DESC, id DESC'). order('created_at DESC, id DESC').
limit(10) limit(10)
datas = []
stream.each do |item| stream.each do |item|
item['history_object'] = item.history_object data = item.attributes
item['history_type'] = item.history_type data['history_object'] = item.history_object
data['history_type'] = item.history_type
datas.push data
# item['history_attribute'] = item.history_attribute # item['history_attribute'] = item.history_attribute
end end
return stream return datas
end end
def self.recent_viewed(user) def self.recent_viewed(user)
@ -40,12 +43,15 @@ class History < ActiveRecord::Base
where( :history_type_id => History::Type.where( :name => ['viewed']) ). where( :history_type_id => History::Type.where( :name => ['viewed']) ).
order('created_at DESC, id DESC'). order('created_at DESC, id DESC').
limit(10) limit(10)
datas = []
stream.each do |item| stream.each do |item|
item['history_object'] = item.history_object data = item.attributes
item['history_type'] = item.history_type data['history_object'] = item.history_object
data['history_type'] = item.history_type
datas.push data
# item['history_attribute'] = item.history_attribute # item['history_attribute'] = item.history_attribute
end end
return stream return datas
end end
private private