Topic: saving layout files in correct directories

When I design sites at work for ASP & PHP sites I usually save all my layout images in a separate directory from my content images.

Looking through my rails structure I notice all of the layout files are in the "public" folder. Is it ok to separate my layout images in a separate folder from the "images" folder that is already there. Only reason I ask is I am aware that Rails relises heavily on naming conventions and directory structures?

Re: saving layout files in correct directories

That's a really good question.  Time after time I've done something custom only to realize that I was fighting against Rails.

The only benefit to putting images in the /public/images directory is you can use image_tag without specifying a full path.  image_tag('photo.jpg') will assume that you're talking about /public/images/photo.jpg.

I always keep my layout images in /public/images and then create separate directories for other stuff.  That lets me manage them in their own way without messing with my layout files.

Re: saving layout files in correct directories

Does that mean that i would have reference images like "image_tag('folder/photo.jpg') depending on what I wanted to use and all my css images would be /public/images/layoutimages/photo.jpg?

Re: saving layout files in correct directories

Unless the string that you give to image_tag begins with a '/' it will assume you're specifying an image relative to /public/images.
image_tag('folder/photo.jpg') # => /public/folder/photo.jpg
image_tag('photo') # => /public/images/photo.png (deprecated)
image_tag('/folder/photo.jpg') # => /public/folder/photo.jpg

What I usually do is since all my non-layout images are part of some model I incorporate path computation into the model.  So:
@portrait.url # => /public/portraits/stephanie.jpg

Re: saving layout files in correct directories

Sorry I'm really new to RoR, still only on chapter 3 of Ruby for rails, so does @portrait.url always pull ou that specific image?

Re: saving layout files in correct directories

Well, I created a custom model called Portrait for one of my sites.  that line of code was totally an example, sorry for the poor explanation.

Unless you set up a Portrait model and specifically set a url method Rails is just going to say "what's a portrait and what's a url?" and barf out some errors.  So, no, it's nothing standard at all.  Sorry for the confusion.

Re: saving layout files in correct directories

ok if I get stuck again when I get to this point in my learning I'll put a post, thanks for the help