Hi,
I've got a bunch of campaigns I wish to render into an index-page. Two diagrams have to be in each campaign (jQuery). One of them requires a database query within a loop (the finished orders for each day of one week).
Since its bad code to put a database query in the view, and I dont want to work with 4 dimensional arrays, I thought about rendering each campaign from a seperate action, with a view attached to it.
But I either get format errors on Nil if I try <% @campaigns.each do |c| %> <%= render :action => "get_single_campaign", :params => {:campaign_id => c.id} %> <% end %>
or with no html at all if I'm using @get_all_campaign_output = "" @campaigns.each do |c| @get_all_campaign_output += get_single_campaign(c.id) end
in the controller (output is a string). I get the feeling my whole approach is wrong, since I cant find a solution and I've been searching for two days already. I hope some of you can tell me how to solve this.
Thanks in advance, Heike