Prev | Current Page 336 | Next

David Berube

"Practical Reporting with Ruby and Rails"

each do |type,msg|%>

<%=msg%>

<%end%>
<%=yield%>


Save this as app/views/layout/application.html.erb.
Note that the layout includes a link to training.css, so you??™ll need to create that next,
as shown in Listing 12-9.
Listing 12-9. Application Stylesheet (public/stylesheet/training.css)
* { font-family: helvetica, verdana, sans-serif; }
div.flash_notice { padding:1em; border: 2px dashed #cecece; margin: 1em 0;}
input.submit_button { width:120px; height:30px; }
Save this file as public/stylesheet/training.css.
Now generate a model, which represents students taking the course:
ruby script/generate model student
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/student.rb
create test/unit/student_test.rb
create test/fixtures/students.yml
create db/migrate
create db/migrate/001_create_students.rb
You??™ll notice it creates a migration for you automatically. Fill that in as shown in
Listing 12-10.
CHAPTER 12 n CREATING REPORTS WITH RUBY AND MICROSOFT OFFICE 242
Listing 12-10.


Pages:
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348