Images and CSS are not used correctly; both are stored in public folder

Hi,
maybe someone of you had the same error in the past and can help me.
I use “InstantRails” for learning Ruby on Rails. I have done some
tests, but always images which are stored under public/images/
rails.png didn’t work. Also direct access to the folder via
http://localhost:3000/admin/images/rails.png didn’t work. Always a
load error is displayed. Only when I insert hardlinks, like c:\path
\rails.png the image is displayed correctly.

What would be the right place to store such an image? Where should I
store them on a local host?

I have the same issue also with the CSS. They are also not loaded
correctly (stored in CSS in public/stylesheet). The CSS is implemented
in the source via <%= stylesheet_link_tag ‘scaffold’, ‘depot’ %> but
not used complete.
The CSS are stored under C:\ror\rails_apps\depot\public\stylesheets .
Is this the right place? Normally it should be, or is their for each
project an own folder?

Knut wrote:

Hi,
maybe someone of you had the same error in the past and can help me.
I use “InstantRails” for learning Ruby on Rails. I have done some
tests, but always images which are stored under public/images/
rails.png didn’t work. Also direct access to the folder via
http://localhost:3000/admin/images/rails.png didn’t work. Always a
load error is displayed. Only when I insert hardlinks, like c:\path
\rails.png the image is displayed correctly.

What would be the right place to store such an image? Where should I
store them on a local host?

I have the same issue also with the CSS. They are also not loaded
correctly (stored in CSS in public/stylesheet). The CSS is implemented
in the source via <%= stylesheet_link_tag ‘scaffold’, ‘depot’ %> but
not used complete.
The CSS are stored under C:\ror\rails_apps\depot\public\stylesheets .
Is this the right place? Normally it should be, or is their for each
project an own folder?

hi, from my experience, on the localhost:3000, the stylesheet goes in
the (rails_apps:) application’s public folder. the same with the
images.

make sure you are starting your SERVER from checked application from
the menu MANAGE RAILS APPLICATIONS.

when you place them on some of the unix hosting servers, it is a bit
different, and a link is required from the mail public_html folder (like
the www folder in instant rails.)

if your image is within your public/images/ directory then you dont
have to anything like http://localhost:3000/admin/images/rails.png
you can simply access it by http://localhost:3000/images/rails.png and
similarly for stylesheet and javascript files like
http://localhost:3000/stylesheets/style.css and
http://localhost:3000/javascripts/controls.js

You dont have to include public or controller name for anything in
public directory,

Yes public/stylesheets is the right place to store your CSS unless you
dont want to follow the rails conventions

Hope that helps.