Inspect routes changes in Rails console.
Add this line to your application's Gemfile:
gem 'pry-rails-diff-routes', group: :development
DiffRoutes will set Pry as the REPL in your Rails console, just like when you use PryRails.
If you already used PryRails, you should install DiffRoutes after it.
gem 'pry-rails' # not a dependency
gem 'pry-rails-diff-routes'
When you type help
in Rails console, you'll notice that diff-routes
is listed in the same
group as PryRails commands.
Rails
diff-routes Show the difference you made in routes.
find-route See which urls match a given controller.
recognize-path See which route matches a url.
show-middleware Show all middleware (that rails knows about).
show-model Show the given model.
show-models Show all models.
show-routes Show all routes in match order.
A route is considered the same route if it maintains its verb (http method, e.g. GET
, POST
,
etc.) and uri path. When its other properties are changed, we call it a modified route.
Show removed routes only.
Show modified routes only.
Show new routes only.
Make current routes as the basis for changes.
You can combine -R
, -M
, and -N
together, but not -S
.
Bug reports and pull requests are welcome on GitHub at https://github.com/styd/diff-routes. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the DiffRoutes project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.