I'm using this plugin to get the default controller / action:
module ActionController
module Routing
def get_default_controller
ActionController::Routing::Routes.routes[0].requirements[:controller]
end
def get_default_action
ActionController::Routing::Routes.routes[0].requirements[:action]
end
end
end
Is this the best way or is there a more simple / easier way to do
this?
ActionController::Routing::Routes.routes[0].requirements[:controller]
end
def get_default_action
ActionController::Routing::Routes.routes[0].requirements[:action]
end
end
end
Is this the best way or is there a more simple / easier way to do
this?
You could use a named route and then access it with that name...
Thanks Philip. But then how do I get the seperate controller and
action from that default method? I need it to add a seperate class to
links with the selected url.
Perhaps you've hinted here at your real problem. Are you thinking that you want to do something like add a 'class' attribute to the link if it's the current page?