I can't comment on how it is done in the book, but this is the general way it works:
Layouts
Live in app/view/layouts. By default, a views generated by a controller will automatically use a layout with the same name* as the controller if such a layout exists. So views used by a controller StoreController will automatically use a layout called store.rhtml or store.html.erb if the file exists.
You can over-ride this behaviour by manually specifying the layout to use by adding something like this to your controller:
Code:
layout "another_layout"
Which would point the controller at a layout file another_layout.rhtml or another_layout.html.erb
Style sheet
Style sheets are stored in public/stylesheets
The style sheet used is usually defined within the layout with the method stylesheet_link_tag. By convention you'd use the controller name again. So in the Store example above you'd add this to the <head> section of your layout:
Code:
<%= stylesheet_link_tag 'store' %>
And this would create a link pointing at public/stylesheets/store.css.
*Using the convention that a contoller 'named' Store has a class name of StoreController and file name store_controller.rb.
Bookmarks