Skip to content

Instantly share code, notes, and snippets.

@camkidman
Created August 1, 2016 17:19
Show Gist options
  • Save camkidman/2afc9dd583a1d4df099b3688e160814b to your computer and use it in GitHub Desktop.
Save camkidman/2afc9dd583a1d4df099b3688e160814b to your computer and use it in GitHub Desktop.
##
# Given the format [{"controller" => ["action0", "action1"]}, ... ]
# this gist should output a "get" method for everything that was there previously.
#
# ... Curse you, rails dynamic routing.
array_of_route_hashes = _
array_of_route_hashes.each do |hash|
hash.each do |controller, action_hash|
action_hash.each do |action|
puts "get '#{controller}/#{action}', :to => '#{controller}##{action}', :as => '#{controller}/#{action}'"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment