Last active
December 17, 2015 05:38
-
-
Save ndizazzo/5559019 to your computer and use it in GitHub Desktop.
Provides an array of your root-level rails routes without leading slashes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
routes = Rails.application.routes.routes.map { |route| route.path.spec.to_s }.each { |r| r.replace(r.match(/^\/(\w+)/).to_s).tr!('/', '') }.delete_if(&:empty?).uniq! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
=> ["assets",
"users",
"sessions",
"signup",
"login",
"logout",
"rails"]