JavaFree.org | RubyOnBr.org

Rghost e Resultado de ActiveResource

Acompanhar Rghost e Resultado de ActiveResource 4 posts, 3 participantes

Avatar Jhonathas S Matos 40 posts

Pessoal cai num problema e ta ruim de sair do outro lado, possuo um find que nada mais é do que um retorno de activeresource olhem abaixo

no meu rghost.rb

Porém como o @events é preenchido apartir de um ActiveResource entao ele da o seguinte erro

/Library/Ruby/Gems/1.8/gems/rghost-0.8.7.2/lib/rghost/grid/rails_grid.rb:46:in `data’: You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.collect

O retorno no script/console do Event.find(:all, :from => :return_period_events, :params => { :member_id => “00170004000010004”, :period => “200901” })
é esse

=> [#<Event:0×103355ee0 @prefix_options={}, @attributes={"created_at"=>Sat Aug 01 14:57:36 UTC 2009, “beneficiary_id”=>"00170004000010004", “service_name”=>"CONSULTA EM CONSULTORIO", “quantity”=>1, “member_id”=>"00170004000010004", “event_id”=>"030211169884", “period”=>200901, “updated_at”=>Sat Aug 01 14:57:36 UTC 2009, “date”=>Fri, 05 Dec 2008, “id”=>16962, “provider_name”=>"EDSON DA CUNHA", “service_id”=>1001, “service_type”=>1, “beneficiary_name”=>"MARGARIDA NUNES SAVERNINI", “dependence_level”=>"TITULAR", “partaking_cost”=>13.8}>, #<Event:0×103355e40 @prefix_options={}, @attributes={"created_at"=>Sat Aug 01 14:57:36 UTC 2009, “beneficiary_id”=>"00170004000010004", “service_name”=>"CONSULTA EM CONSULTORIO", “quantity”=>1, “member_id”=>"00170004000010004", “event_id”=>"030811363718", “period”=>200901, “updated_at”=>Sat Aug 01 14:57:36 UTC 2009, “date”=>Fri, 12 Dec 2008, “id”=>16963, “provider_name”=>"ROBERTO MAURO SANTOS DE SA", “service_id”=>1001, “service_type”=>1, “beneficiary_name”=>"MARGARIDA NUNES SAVERNINI", “dependence_level”=>"TITULAR", “partaking_cost”=>13.8}>]

Então com essas informações será que alguem consegue entender o motivo do meu problema ? Agradeço a todos desde já.

 
Logo_eiq Kivanio 239 posts

Jhonathas,

o Rghost tem um grupo de discussão agora, talvez postar a dúvida lá seja mais fácil de obter uma resposta.

http://groups.google.com/group/rghost-pt

 
Avatar Shairon Toledo 1428 posts

Acho que @events está como nil, vc está usando algum filtro, etc?

 
Avatar Jhonathas S Matos 40 posts

Olá, Sharon, O resultado do mesmo Find so que executado no console é oque postei acima, acredito ser alguma coisa na estrutura retornada.