Hi everybody I have a ROR application which generates some stats taking data from a db table. To get the results I before create an array with all the values involved in the stats - each data stack label - ... then calculate the time interval splited for week or month... and for each splitted interval I have an Activerecord calculte(:count) method in order to create - for each data stack - an array of values... This seems to work done, but sometimes something goes wrong, couse I return empty or nil array of results. I fixed it with a control to avoid system errors. But Anyway it happens... And I loose some data in my stats. Looking at the mysql query log, all the query are executed... How can I menage this situation? Is it possible to observ the ActiveRecord::calculate feedback to understand exactly what randomly happens with these query? here is an abstract of the code -------------------------------------------- results=[] arr_data_stack.each do |x| values_array = [] CalculateInterval.each do |interval| values_array << Log.calculate(:count, [... ]) if x end results[x] = (values_array .empty? ? 0 : values_array) end -------------------------------------------- the problem is the result[x] is sometimes empty or nil - I don''t know exactly - even if all the query were executed on db let me know your opinion please thanks a lot cheers Marsenio -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---