All pastes #58407 Raw Edit

Untitled

public text v1 · immutable
#58407 ·published 2006-05-23 16:52 UTC
rendered paste body
rails view:
<div id="graph">
</div>
<div id="graph_type">
<%= link_to_remote 'weekly', :update => 'graph', :url =>{:controller => 'graph', :action => 'test_html', :text => 'weekly'} %>
</div>
  


graph controller:

  def test
    text = params[:text] || 'test'
    g = Gruff::Line.new(400)
    g.title = text
    data = [0,2,2,nil,nil]
    g.data(text,data)
    send_data(g.to_blob, 
            :disposition => 'inline', 
            :type => 'image/jpg', 
            :filename => 'test.jpg')
  end
  
  def test_html
    render :text => "<img src=\"#{url_for :controller => 'graph', :action => 'test', :text => params[:text]}\""
  end