列出项目中的controler和他对应的actions:
@controller_actions = ActionController::Routing::Routes.routes.inject({}) do |controller_actions, route|
(controller_actions[route.requirements[:controller]] ||= []) << route.requirements[:action]
controller_actions
end
来源:http://snippets.dzone.com/posts/show/4792
@controller_actions = ActionController::Routing::Routes.routes.inject({}) do |controller_actions, route|
(controller_actions[route.requirements[:controller]] ||= []) << route.requirements[:action]
controller_actions
end
来源:http://snippets.dzone.com/posts/show/4792