ppk007
ppk007

Reputation: 67

In the ROR Tutorial, rails can't find CSS files (custom.css & blueprint) or logo.png

In section 5.1 of the tutorial, Rails can't seem to find the CSS file (custom.css or the blueprint files) or logo.png. I have triple-checked the code and it's identical to what is in the git repository.

I have also read the asset pipeline guide and all the default values are correct.

I am a 100% sure that it has something to do with the asset pipeline, but I can't seem to figure it out.

Thanks in advance for your help.

Here is a listing of my public directory:

$ ls public/images public/stylesheets
public/images:
logo.png

public/stylesheets:
blueprint/  custom.cssls images stylesheets

Here are the errors that I'm getting:

Started GET "/assets/custom.css" for 127.0.0.1 at 2011-12-15 14:23:20 -0800
Served asset /custom.css - 404 Not Found (14ms)

Started GET "/assets/blueprint/screen.css" for 127.0.0.1 at 2011-12-15 14:23:20 -0800
Served asset /blueprint/screen.css - 404 Not Found (2ms)

Started GET "/assets/logo.png" for 127.0.0.1 at 2011-12-15 14:23:20 -0800
Served asset /logo.png - 404 Not Found (3ms)

Upvotes: 3

Views: 1403

Answers (2)

klaffenboeck
klaffenboeck

Reputation: 6377

I think Emily is pointing you in the right direction, the application is looking for the images in assets-folder, not in the public-folder. Instead of moving it out of the public folder, I would recommend to disable the asset-pipeline as long as you are dealing with the tutorial (just so you can follow the tutorial as written).

To achieve this, go into your config/application.rb-file and look out for the following line:

# Enable the asset pipeline
config.assets.enabled = true

and set the value to false

# Enable the asset pipeline
config.assets.enabled = false

You will also have to remove/comment out sass-rails from your Gemfile.

After that restart your server and it should work as expected.

Once you have finished the tutorial, you should consider bending your head around the asset-pipeline, since the benefits out of it are worth the while :-)

Upvotes: 2

Emily
Emily

Reputation: 18193

It looks like the app is looking for your stylesheets and images in the assets directory instead of the public directory. Try moving them there, and it should work.

Upvotes: 1

Related Questions