2

I just started diving into the world of Rails by reading the well known pragmatic book shelf book "Agile web development with rails".

So far I did follow all the examples, but now I am stuck on page 85 (pdf version) where a custom CSS is supposed to be added to the project.

I put the css file (which can be obtained here ) in the "/public/stylesheets/" folder.

But when I visit the /products page in the browser the CSS IS NOT applied to the products listing page. All the content of the page shows up, just the CSS formatting is missing. The page is generated by this .erb file.

Did any of you experience the same problem when following the examples in the book? Does anybody have an idea what's going wrong?

Thank you so much for your help & enjoy the day!

tobi

tobias.henn
  • 225
  • 2
  • 13

2 Answers2

2

The latest edition of this book is for Rails 3.2 (with Asset Pipeline). You should put your stylesheet under /app/assets/stylesheets.

Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367
1

I am using the Agile web development with Rails - 4th edition. I was able to solve this problem by including <%= stylesheet_link_tag "application", :media => "all"%> inside /app/view/layouts/application.html.erb and having the depot.css.scss file in app/assets/stylesheets/depot.css.scss. This worked perfectly for me.