Browse Source

Fixed warnings.

Martin Edenhofer 13 years ago
parent
commit
575fb17964
2 changed files with 18 additions and 12 deletions
  1. 6 6
      app/controllers/ticket_overviews_controller.rb
  2. 12 6
      app/models/history.rb

+ 6 - 6
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
     }
 

+ 12 - 6
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