Dears,
Got a controller witch do a send_data for displaying a chart.
like :
send_data(g.to_blob, :filename => “any.png”, :type => ‘image/png’,
:disposition=> ‘inline’)
I actually do a

Is there any way more clean to do that ? At minima don’t hardcode the
beginning of the url (host:port)
I’ve tried a bit ‘render’ w/o success.
Thanks
Just use
. Image_tag is too wordy here.
On 19.1.2006, at 0.16, Dylan M. wrote:
When I try something like this, the resulting HTML links to “/stats/
make_graph.png” instead of “/stats/make_graph”. Because of this,
only the “alt” title shows up with no graph. I have to manually
create an
tag to get it to work.
image_tag is a bit “too” wise in this case, because it adds the .png
to the image name by default if there’s no suffix.
You can fix it by creating a route like this:
map.connect ‘stats/make_graph.png’, :controller => ‘stats’, :action
=> ‘make_graph’
and putting it in your config/routes.rb. Then the image url even
looks like an image filename.
//jarkko
Dylan M. wrote:
When I try something like this, the resulting HTML links to
“/stats/make_graph.png” instead of “/stats/make_graph”. Because of this,
only the “alt” title shows up with no graph. I have to manually create
an
tag to get it to work.
In that case:
<%= tag ‘img’, :src => url_for(…), :alt => ‘foo’ %>