Basic Ruby on Rails Question about routing

Posted by Acidburn2k on Stack Overflow See other posts from Stack Overflow or by Acidburn2k
Published on 2010-03-24T08:02:07Z Indexed on 2010/03/24 8:03 UTC
Read the original article Hit count: 468

Filed under:
|
|
|

I have a controller without any related model. This controller is to span some informations from various models. I have lots of actions there, which define certain views on the page. What would be the best way to organize routes for this controller.

What I would like is to have /dashboard/something point to any action in the dashboard controller. Not actions like new/edit but arbitrary (showstats, etc).

With trail and error I made something like this:

map.dashboard 'dashboard/:action', :controller => 'dashboard', :action => :action

Now it is possible to access those url using helper:

dashboard_url('actionname')

This approch seems to be working ok, but is this the way to go? I am not quite sure understand, how are the helper method names generated. How to generate same helper names as in basic controllers "action_controller_url" ? That would be more generic and made the code more consistent.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about url-routing