[Rg 47] Slightly irritating template bug

Lars Olsson lasso at lassoweb.se
Sun Jul 8 05:49:59 EDT 2007


Hi!

I'm nothing a slightly irritating "bug" when using multiple Controllers 
and templates in Ramaze. Lets say I have the following Controller map:

/ => MainController
/foo => FooController

I also have the following file structure in my "public" dir (mirroring 
the controller map):

public
     css
     images
     foo
       css
       images

Now, lets say I have he following HTML snippets in my foo/index.xhtml 
template:

<link rel= "StyleSheet" type="text/css" href="css/foo.css"/>
<img src="images/foo.png"/>

Let's fire up the web browser and try the following two urls:

http://mysite/foo
http://mysite/foo/ (notice trailing slash)

In both cases the right Controller (FooController) gets called, but in 
the first case "relative" links (like in the html snippets above) 
doesn't work as intended. If I look at the console I can see:

[2007-07-08 11:18:49] ERROR  #<Ramaze::Error::NoAction: No Action found 
for `/css/foo.css' on MainController>

So, even though the FooController renders the template, it looks like 
the MainController gets called on all the "relative" stuff in the template.

Since it's hard to force anyone to use a trailing slash when browsing 
the web, I think the current behavior is a bug. There are of course ways 
around the problem....I could stop using relative links. Another way is 
to redirect the index action to another action, but neither of those 
solutions seems "the right thing to do".

What do you think? Is it a bug or intended behavior? Is it fixable?


Kindly

/lasso


More information about the Ramaze-general mailing list