Hi, I have a controller that uses gruff to create a chart. I would like to be able to return this image back to the view without having to dump the image to disk first. Does anyone have sample code for the controller and view to handle such a problem ? Thank you all !!
on 2005-12-04 23:05
on 2005-12-04 23:51
On Dec 4, 2005, at 1:05 PM, KiteSurfer KiteSurfer wrote: > Does anyone have sample code for the controller > and view to handle such a problem ? Create a specific action to generate the image and send it with [send_data]. --Steve : http://api.rubyonrails.com/classes/ActionController/ Streaming.html#M000041
on 2005-12-05 01:27
Thanks Steve !! That helps but... send_data will forward me to a new page. I want to be able to display the chart within the existing page ? I guess I am not really sure how to formulate the send_data from within the page ??
on 2005-12-05 01:53
On Dec 4, 2005, at 3:27 PM, KiteSurfer KiteSurfer wrote: > I guess I am not really sure how to formulate the send_data from > within > the page ?? Create a separate dedicated action, just for the image, then within whatever page you just link to that like a regular image. HTH, Steve
on 2005-12-05 02:23
Got it !! Thanks Steve you tough me something cool today... Now do you know how to accomplish the same thing using an ajax call ?
on 2005-12-05 06:12
On Dec 4, 2005, at 4:23 PM, KiteSurfer KiteSurfer wrote: > Now do you know how to accomplish the same thing using an ajax call ? Someone else will have to chime in to help you with that. :) Good luck. --Steve
on 2005-12-05 06:16
I'm not sure if it's possible, as ajax only deals with text based data. However, you might be able to send an <img> tag that loads a dynamic image...
on 2005-12-05 07:08
hmmm, a noob ruby question. After I gem install gruff, I opened the irb to try require 'rubygems' and require 'gruff', and then I got two false. Why? I'm using ruby 1.8.3 on WinXP. I also put the sample code from gruff's home page into a controller. It seems rails still didn't know the name of 'gruff'. Thanks, Sky
on 2005-12-05 08:21