class grade.training_class.name
xml.grade grade.percentage_grade
xml.took_class_at grade.took_class_at
end
end
end
Save this as app/views/log/index.xml.builder.
You??™ll notice a reference to a stylesheet for your XML. Let??™s create that now, as shown
in Listing 12-7.
Listing 12-7. XML Download Stylesheet (public/stylesheets/log.css)
* {
display:block;
font-family: helvetica, verdana, sans-serif;
}
grades {
padding:1em;
}
grade {
margin-top:1em;
}
student {
font-weight: bold;
}
Note that this stylesheet affects only your XML, not your HTML views.
You now have two views, but no layout. Let??™s create a layout for them, as shown in
Listing 12-8.
Listing 12-8. Application-Wide Layout (app/views/layout/application.html.erb)
Training Uploader Application <%=@title || ''%><%= stylesheet_link_tag 'training.css'%>
<%= javascript_include_tag :defaults %>
<%= calendar_date_select_includes "silver"%>
<%=@title%>
CHAPTER 12 n CREATING REPORTS WITH RUBY AND MICROSOFT OFFICE 241
<%flash.
Pages:
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347