0

I put my css file into public/stylesheets directory (by the way, there was no stylesheets directory by default). From the layout in app/views I render it by

<%= stylesheet_link_tag "main" %>

When I view the page css doesn't appear to work(no changes comparing with clean html), in the html code I see this one:

<link href="/assets/main.css" media="screen" rel="stylesheet" type="text/css" />

I don't understand why are assets here instead of stylesheets and what am I doing wrong?

2 Answers 2

5

Rails 3.1, right? If so, you'd want to put your stylesheet in app/assets/stylesheets/main.css.

Sign up to request clarification or add additional context in comments.

Comments

0

Is there a file at /assets/main.css? Use that instead, or replace it.

What version of rails are you using? Rails3? Are you following a Rails2 tutorial by chance?

2 Comments

I use rails3 and even in rails tutorial guides.rubyonrails.org/layouts_and_rendering.html it's said that the directory should be /public/stylesheets.
I think that tutorial is slightly out of date, if you're using the very latest Rails 3.1 (per mu's answer).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.