CSS Problem.

Hi Everyone,

     I was going through the Rails tutorial from here:

http://ruby.railstutorial.org/chapters/filling-in-the-layout#top

I was getting this exception on my WebRick server:

Started GET "/assets/blueprint/print.css" for 127.0.0.1 at 2011-11-28
14:43:00 +0530
Served asset /blueprint/print.css - 404 Not Found (0ms)

ActionController::RoutingError (No route matches [GET]
"/assets/blueprint/print.css"):

Now i would like to know that when the server is looking under the
assets folder then does it mean that it is the assets folder inside app?
Or do i have to place the assets folder under root application
directory?

The guide says to put it under the /public folder. I am a but confused.
The images, css nothing is being picked up by the browser.

I am on WinXP with Rails 3.1.3.

One way it would be to put the blueprint-stuff under
<rails_root>/public/assets/blueprint/* but this will only work if you
use the static files of blueprint. If you use it with another framework
above it like compass, it seems that you have to wait until that is
ported to the rails asset pipeline.

Also that tutorial is for rails 3.0, which not has the asset-pipeline.
So with all assets related stuff you will stumble upon some problems.

Just start again and use the rails version of that tutorial (3.0.11)

HTH
Norbert

The tutorial states to put images into the public/images folder

and

custom made stylesheets into public/stylesheets/ and blueprint stuff
into public/stylesheets/blueprint

But it doesn't work for me.

I would give your path a try and let you know. But from what you are
saying that there maybe nothing wrong with what i have done, its just
that some features are yet to added into 3.1.3?

Thanks, your path worked. But seems a bit strange. That the paths
mentioned in the tutorial and the actual path would vary so much, just
because i am just a few versions up the ladder.

Have a look at the last chapter of the tutorial, it explains how it
works on 3.1. Though as Somnath suggested it may be easier to work
through the tutorial using the earlier rails version, then move to 3.1

Colin

Ok... I will go step by step. And reach the last chapter. But thanks for
the help.

Not finding myself at home with Ruby/Rails at all! :frowning:

http://railscasts.com/episodes/279-understanding-the-asset-pipeline

You could start with 3.0 and move up to 3.1, as 3.1 introduced several major changes.

Dheeraj Kumar

With the introduction of the asset-pipeline the behaviour of
stylesheet_link_tag changed. This is what makes it incompatible, same is
for the corresponding javascript and image helpers.

In 3.0 and before, the helpers were wired to /public/stylesheets (or
images, javascripts) and you had to place a copy of your css there.

Now with 3.1 and the introduction of the assetpipeline there were changes.

All helpers now create a reference to "/assets/<filename>". You can
either put static assets there, or the recommended way, put your assets
in the corresponding folder under /app/assets/.

The big advantage of this way is, that you can have stylesheets or
javascript in a template or alternative language like less, sass or scss
for styles or coffeescript for javascript.

Theoretically you could even drop your stylesheets in brainfuck[1] if
someone provides a gem that processes the brainfuck document.

The disadvantage on the other hand: People following 3.0 tutorials on a
3.1 environment, asking themself "Why doesnt that work? I using rails
3!" But not realizing the change in the minor version number, since in
many heads a change in minor still means "compatibility"

I hope this short excurse is helping you to get over your problems.

Bye
Norbert

PS: Please use quoting in the future and quote the parts of the message
you are refering to, this would make following the conversation easier.

  [1]: http://en.wikipedia.org/wiki/Brainfuck

I would go back and work through from the beginning, installing the version of Ruby the tutorial advises using RVM. This will make it MUCH easier to learn.

OR

If you feel confident, and are up to the challenge, you could skip forward to the last chapter, get an understanding for the differences and changes you need to make in order to get the application working in 3.1. Then work through it from the start, making changes for 3.1 as you go. BUT, this would potentially be very confusing and frustrating for someone just learning frameworks and programming for the first time.

I chose the first option. I found this gave me a greater understanding of Rails, as I now understand how 3.0 worked, but have since moved on to working with 3.1

As covered in another comment, don’t be fooled in the small version number. They made some very significant changes to 3.1 that change the way you work with Rails completely.

Good luck, followed from the start, this is a excellent tutorial.