Forum: Ruby on Rails rails routing without slash separator

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8a77648da224758bda62bb9b6827c7d5?d=identicon&s=25 Adam Salter (Guest)
on 2007-05-08 09:09
(Received via mailing list)
Hey all...

I'm here with a bit of a gripe that I hope somebody can help me

Basically I don't want to use slashes as seperators for routes in
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,
A2c85dc5ee81b12e3cc0a6522e8d079d?d=identicon&s=25 Chris Hall (au5lander)
on 2007-05-08 12:49
(Received via mailing list)
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.
8a77648da224758bda62bb9b6827c7d5?d=identicon&s=25 Adam Salter (Guest)
on 2007-05-08 15:24
(Received via mailing list)
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 "
dosomthing:term1:term2" would not muck up the URL directory structure
for templates.

Hope I've made myself clear,
This topic is locked and can not be replied to.