# Rails routing without slash separator

**URL:** <https://www.ruby-forum.com/t/rails-routing-without-slash-separator/103597>\
**Category:** Rails\
**Created:** [May 8, 2007, 9:09am UTC](https://www.ruby-forum.com/t/rails-routing-without-slash-separator/103597 "2007-05-08T09:09:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asetzler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@asetzler](https://www.ruby-forum.com/u/asetzler)\
**Post date:** [May 8, 2007, 9:09am UTC](https://www.ruby-forum.com/t/rails-routing-without-slash-separator/103597/1 "2007-05-08T09:09:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![asetzler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@asetzler](https://www.ruby-forum.com/u/asetzler)\
**Post date:** [May 8, 2007, 12:49pm UTC](https://www.ruby-forum.com/t/rails-routing-without-slash-separator/103597/2 "2007-05-08T12:49:05Z")

</div>

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.

![](https://www.ruby-forum.com/images/...)

not sure what you mean by “different path lengths” and “you can’t use  
standard relative urls for images”

please explain further.

---

<div class="post-metadata">

**Author:** ![asetzler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@asetzler](https://www.ruby-forum.com/u/asetzler)\
**Post date:** [May 8, 2007, 3:24pm UTC](https://www.ruby-forum.com/t/rails-routing-without-slash-separator/103597/3 "2007-05-08T15:24:32Z")

</div>

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/](http://mydomain.com/)  
dosomthing:term1:term2” would not muck up the URL directory structure  
for templates.

Hope I’ve made myself clear,  
-Adam
