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

**URL:** <https://www.ruby-forum.com/t/images-and-css-are-not-used-correctly-both-are-stored-in-public-folder/121280>\
**Category:** Rails\
**Created:** [November 26, 2007, 1:19pm UTC](https://www.ruby-forum.com/t/images-and-css-are-not-used-correctly-both-are-stored-in-public-folder/121280 "2007-11-26T13:19:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![knut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/bbe5ce/32.png) [@knut](https://www.ruby-forum.com/u/knut)\
**Post date:** [November 26, 2007, 1:19pm UTC](https://www.ruby-forum.com/t/images-and-css-are-not-used-correctly-both-are-stored-in-public-folder/121280/1 "2007-11-26T13:19:53Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![knut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/bbe5ce/32.png) [@knut](https://www.ruby-forum.com/u/knut)\
**Post date:** [November 26, 2007, 9:45pm UTC](https://www.ruby-forum.com/t/images-and-css-are-not-used-correctly-both-are-stored-in-public-folder/121280/2 "2007-11-26T21:45:40Z")

</div>

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](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.)

---

<div class="post-metadata">

**Author:** ![knut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/bbe5ce/32.png) [@knut](https://www.ruby-forum.com/u/knut)\
**Post date:** [November 27, 2007, 1:29pm UTC](https://www.ruby-forum.com/t/images-and-css-are-not-used-correctly-both-are-stored-in-public-folder/121280/3 "2007-11-27T13:29:36Z")

</div>

if your image is within your public/images/ directory then you dont  
have to anything like [http://localhost:3000/admin/images/rails.png](http://localhost:3000/admin/images/rails.png)  
you can simply access it by [http://localhost:3000/images/rails.png](http://localhost:3000/images/rails.png) and  
similarly for stylesheet and javascript files like  
[http://localhost:3000/stylesheets/style.css](http://localhost:3000/stylesheets/style.css) and  
[http://localhost:3000/javascripts/controls.js](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.
