eugeniodepalo/gosugamers-api — Issue #1: objects is empty in synchronize! 
Author: charlescui
Created: 2011-10-24 12:30:54+00:00
State: open

** Execute db:synchronize:matches
error about objects []
error about objects []

module SingletonMethods
def synchronize!
@games.each do |game|
begin
key = "last_#{name.downcase}_#{game}"
last_obj_s = $redis.get(key)
objects = find(:page => 1, :game => game)
$redis.set(key, { :id => objects.max{ |a, b| a.id <=> b.id }.id }.to_json)
next unless last_obj_s
last_obj = JSON.parse(last_obj_s)
objects.keep_if { |o| o.id > last_obj['id'] }.each { |o| o.to_notification.push! }
rescue => ex
puts "error about objects #{objects.inspect}"
end
end
end
end