Prev | Current Page 277 | Next

David Berube

"Practical Reporting with Ruby and Rails"

.. upload a New Apache Log?
<% form_tag( { :controller => :logs,
:action => :upload } , {:multipart => true} )do %>
<%=file_field 'log', 'file' %>
<%=submit_tag 'Upload with Active Record',
:name=>:upload_with_active_record%>
<%=submit_tag 'Upload with Active Record Extensions',
:name=>:upload_with_active_record_extensions%>
<%end%>

... <%=link_to 'clear your old logs?',
:controller=>:logs, :action=>:clear_all%>


... <%=link_to 'view the cost per sale report?',
:controller=>:report, :action=>:combined, :format=>'pdf'%>


Save this as app/views/home/index.html.erb.
Next, Listing 10-7 shows the .rpdf view that will create the report.
Listing 10-7. Report .rpdf View (app/views/report/combined.pdf.rpdf)
pdf.select_font "Times-Roman"
figure_number = 1
@graph_files.each do |title, graph|
pdf.image graph
pdf.text "Figure #{figure_number
} of #{@graph_files.length
}- #{title}
", :left=>6, :font_size=>12
figure_number = figure_number + 1
end
Save this as app/views/report/combined.


Pages:
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
Thalia The Last Goodnight The Killers Jordin Sparks The View