All pastes #58403 Raw Edit

Untitled

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


generated html from view:

<div id="graph">
</div>
<div id="graph_type">
<a href="#" onclick="new Ajax.Updater('graph', '/graph/test?text=weekly', {asynchronous:true, evalScripts:true}); return false;">weekly</a>
</div>

test action in 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/png', 
            :filename => 'test')
  end