Created
October 21, 2015 14:35
-
-
Save timoschilling/c7d16986aba79d678d33 to your computer and use it in GitHub Desktop.
find Rails url helper name
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
def find_route_name(path) | |
Rails.application.routes.routes.select do |route| | |
route.path.match path | |
end.map(&:name).compact.first | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment