I’m trying to create a modules based system where my controllers are
all under modules. So the structure looks something like:
Each of those controller has it’s own view, and there’s a central
application.rhtml for the layout. The layout has in it links to each
of the controllers using the form:
url_for(:controller => ‘message/news’, :action => ‘show’)
The routing is:
map.connect ‘’, :controller => ‘home_page’, :action => ‘show’
map.connect ‘/home_page’, :controller => ‘home_page’, :action =>
map.connect ‘/news’ , :controller => ‘message/news’ , :action =>
map.connect ‘/books’ , :controller => ‘library/books’ , :action =>
Install the default route as the lowest priority.
When I access the initial page - http://localhost:3000/ everything is
fine, but once I access one of the shortcuts, i.e.
https://localhost:3000/books, the url_for(:controller =>
‘message/news’, :action => ‘show’) will return a wrong url. What I get
http://localhost:3000/books/message/news/show. As you can see the
/books part remains part of the URL, though I don’t see why the
url_for() will not ignore this part. Actually, url_for returns
/books/message/news/show. The protocol and host are added by the
client. But still, the /books part should not be there.
Any pointers as to how I should handle that?
Family management on rails: http://www.famundo.com - coming soon!