Skip to content

Instantly share code, notes, and snippets.

@ilyakatz
Created January 4, 2013 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyakatz/4456238 to your computer and use it in GitHub Desktop.
Save ilyakatz/4456238 to your computer and use it in GitHub Desktop.
script to determine all controllers in challengepost
def add_controllers(routes, all_controllers)
routes.each do |route|
requirements = route.requirements
controller_name = requirements[:controller]
action = requirements[:action]
if controller_name
all_controllers << "#{controller_name.camelize}Controller##{action}"
end
end
end
all_controllers=Set.new
[ Admin::Engine.routes,
Challenges::Engine.routes,
Home::Engine.routes,
Devise::Engine.routes,
Groups::Engine.routes,
Rails.application.routes].each do |route_map|
add_controllers(route_map.routes, all_controllers)
end
all_controllers.each do |c|
puts c
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment