Hey all... I'm here with a bit of a gripe that I hope somebody can help me with... Basically I don't want to use slashes as seperators for routes in rails... 1. is this possible? 2. if so how? I've got a designer that needs to be able to edit templates and they want to add their own graphics to the template (as you do... ) but you have to refer to images etc using the rails <% show_image %> type tags because all the urls have different path lengths... (in other words, you can't use standard relative urls for images, or anything else for that matter) This is pretty silly if it's a small, non-dynamic image, honestly... and you can't preview it without a rails server. My solution: remove the slashes from the url, unless it's an "actual" directory path of course... Thanks in advance, -Adam
on 2007-05-08 09:09
on 2007-05-08 12:49
I'm not sure I understand what you mean here. what's stopping you from putting the images in the railsapp/public/images directory? There's nothing saying you MUST use <%= image_tag ... -%>, you can use the standard html tag and skip the rails method. <img src="/images/..." /> not sure what you mean by "different path lengths" and "you can't use standard relative urls for images" please explain further.
on 2007-05-08 15:24
Sorry I'm not sure I made myself clear, I'm not worried about the images, I'm worried about the templates. The html tag you suggested works, but the main issue (and it's something that everybody must encounter I would imagine) is that you can't reference images in templates with a graphical editor like Dreamweaver... it's crazy. e.g. "/images/" is not a relative path... "../../images/" would be. Basically rails uses "artifical" path lengths (it uses slashes, which are supposed to be a directory seperator, as a web term seperator) so the template is not considered by the browser to be in the root... The issue I encounter is that graphical html editors (read Dreamweaver) don't understand that a template is not part of the directory tree... a template might be in some_dir/app/views/ but the images are in some_dir/public/images/ so how do you indicate to the editor what image URL it should use to reference it? Usually it ends up putting in a relative URL like "../../../public/images/" which of course we know is not going to work - it would be funny if it weren't such a pain. In other template systems I put the templates into a subdirectory or the images root, let the designer edit them... then move them into the correct final template directory... but rails uses slashes for everything so relative URLs _still_ don't work... So what I would like to do is use something other than slashes for term seperators in rails e.g. a URL like "http://mydomain.com/ dosomthing:term1:term2" would not muck up the URL directory structure for templates. Hope I've made myself clear, -Adam