One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
namespace :routes do | |
desc 'Print out all defined routes in match order, with names, per constraint class. Target specific constraint class with CONSTRAINT=x. Target specific controller with CONTROLLER=x.' | |
task constrained: :environment do | |
Rails.application.reload_routes! | |
constraints_routes = Hash.new | |
Rails.application.routes.routes.each do |route| | |
group = (route.app.class == ActionDispatch::Routing::Mapper::Constraints ? route.app.send( :constraints ).first.to_s : 'No constraint class') | |
constraints_routes[group] ||= [] |