tobias.henn
tobias.henn

Reputation: 225

"Agile web development with rails" book: CSS not applied

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

Upvotes: 2

Views: 622

Answers (2)

Rukmani Vijayakumar
Rukmani Vijayakumar

Reputation: 41

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.

Upvotes: 1

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230346

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

Upvotes: 2

Related Questions