diff --git a/README.md b/README.md index d0b0bb6..8252a3e 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Select Value For SQL Counts](rails/select-value-for-sql-counts.md) - [Show Pending Migrations](rails/show-pending-migrations.md) - [Show Rails Models With Pry](rails/show-rails-models-with-pry.md) +- [Show Rails Routes With Pry](rails/show-rails-routes-with-pry.md) ### ruby diff --git a/rails/show-rails-routes-with-pry.md b/rails/show-rails-routes-with-pry.md new file mode 100644 index 0000000..f8beef6 --- /dev/null +++ b/rails/show-rails-routes-with-pry.md @@ -0,0 +1,30 @@ +# Show Rails Routes With Pry + +In [Show Rails Models With Pry](show-rails-models-with-pry), I showed that +[`pry-rails`](https://github.com/rweng/pry-rails) comes with some handy +console commands. In addition to being able to list all your Rails models, +you can list all the routes for your application using `show-routes`. + +I get the following output by using that command in a small blog project: + +``` +> show-routes + Prefix Verb URI Pattern Controller#Action + root GET / application#index +markdownify_articles POST /articles/markdownify(.:format) articles#markdownify + articles POST /articles(.:format) articles#create + new_article GET /articles/new(.:format) articles#new + edit_article GET /articles/:id/edit(.:format) articles#edit + article GET /articles/:id(.:format) articles#show + PATCH /articles/:id(.:format) articles#update + PUT /articles/:id(.:format) articles#update + users POST /users(.:format) users#create + new_user GET /users/new(.:format) users#new + user GET /users/:id(.:format) users#show + sessions POST /sessions(.:format) sessions#create + new_session GET /sessions/new(.:format) sessions#new + session DELETE /sessions/:id(.:format) sessions#destroy + signin GET /signin(.:format) sessions#new + POST /signin(.:format) sessions#create + signup GET /signup(.:format) users#new +```