Forum: Ruby on Rails FusionCharts empty value

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
28be3be213eeed3f66e0a20f1e20c7ac?d=identicon&s=25 Remco Swoany (zwaan123)
on 2009-02-23 19:28
Hi

I have this method. When i run it the @arr_data returns no value, so the
graph remains empty. When i hard-code the value in the array, like this
@arr_data << ['test', '1234'] it works. What i am doing wrong??

def stacked

      headers["content-type"]="text/html";
      @arr_data = []
      #Get data from factory masters table

      factory_masters = Fusioncharts::FactoryMaster.find(:all)
      factory_masters.each do |factory_master|
          total = 0.0
          factory_id = factory_master.id
          factory_name = factory_master.name
          factory_master.factory_output_quantities.each do
|factory_output|
                  total = total + factory_output.quantity
          end
          # Push the hash of values into the array
          @arr_data <<
{:factory_name=>factory_name,:factory_output=>total}

      end
    end
This topic is locked and can not be replied to.