Created
October 31, 2013 11:39
-
-
Save toxaq/7248280 to your computer and use it in GitHub Desktop.
Rails route dumping
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
<% Rails.application.routes.routes.map do |route| %> | |
<% | |
path = route.path.spec.to_s | |
next if path.starts_with? '/admin' | |
controller = route.defaults[:controller].to_s | |
action = route.defaults[:action].to_s | |
is_permitted = permitted_to? action.to_sym, controller.sub(/\//, '_').to_sym | |
%> | |
<tr><%#<td><%= route.name </td>%> | |
<td><%= path %></td> | |
<td><%# controller %><%= controller.sub(/\//, '_') %></td> | |
<td><%= action %></td> | |
<td style="color:#fff;background-color: <%=(is_permitted)? '#5BB75B' : '#DA4F49' %>"><%= (is_permitted) ? "Yes" : "No" %></td> | |
</tr> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment