I’m still dtarting with ruby on rails. And I’m trying to have a menu
depending on the current controller/method.
Here is what I was thinking of (please tell me if there’s a better way
to do it):
I have a database with menu_groups (corresponding to controllers) and
menu_elements(corresponding to methods). Each menu_element belongs to
I created a class Menu where I get all the menu_groups and
menu_elements, and where I have the active controller and method.
@menu_groups << MenuGroup.find(:name,:order => "id") @menu_group_active = controller.controller_name @menu_elements << MenuElement.find(:all,:order => "menu_group_id
@menu_elements_active = current_url_elements[-1]
Then, thanks to the attributes of this class I’ll be able in my layout
to make the difference between active and non active groups/elements.
The problem here is that I don’t know how to get the url into a
If my method is good, can you please tell me how to make it works?
If not, can you show me the right way to do this??
Thanks a lot