Letractively / activeweb

Automatically exported from code.google.com/p/activeweb
0 stars 0 forks source link

Router.generate ignores routes #104

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If I have this route defined:

route("/join").to(PersonController.class).action("join");

I would expect this link to tag: 

<@link_to controller="person" action="join" >Join</@link_to>

to generate this link:

<a href="/contextname/join">Join</a>

but instead it generates:

<a href="/contextname/person/join">Join</a>

Looking at the code it seems that the Router.generate method is a static method 
and doesn't even have access to the routes instance variable. Doesn't rails to 
reverse routing when generating urls? Seems like some of the basic routes could 
be matched in reverse pretty easily.

Original issue reported on code.google.com by evan.leo...@gmail.com on 28 May 2012 at 8:43

GoogleCodeExporter commented 8 years ago
This is not implemented, and not sure this is the best implementation (or 
expected). 
In other words, Rails features should be approached with a grain of salt.
The reason, is, maybe I just want to generate a standard route. 
Instead, I was thinking of implementing a named route system, for instance:

name("join").route("/join").to(PersonController.class).action("join");

now, that this route has a name, I could do this:

<@link_to name="join">Join!</@>

Ideas?

Original comment by ipolevoy@gmail.com on 29 May 2012 at 7:56

GoogleCodeExporter commented 8 years ago
Named routes would work too. As long as all the routing goo is contained to the 
routeconfig file, and not in templates, then I'll be satisfied =)

Original comment by evan.leo...@gmail.com on 29 May 2012 at 2:06