rails-froutes
This gem fills route name displayed by rake routes
task.
Overview
# config/routes.rb
RailsApp::Application.routes.draw do
resources :blogs do
resources :posts
end
end
Default outputs (by rake routes
)
blog_posts GET /blogs/:blog_id/posts(.:format) posts#index
POST /blogs/:blog_id/posts(.:format) posts#create
new_blog_post GET /blogs/:blog_id/posts/new(.:format) posts#new
edit_blog_post GET /blogs/:blog_id/posts/:id/edit(.:format) posts#edit
blog_post GET /blogs/:blog_id/posts/:id(.:format) posts#show
PUT /blogs/:blog_id/posts/:id(.:format) posts#update
DELETE /blogs/:blog_id/posts/:id(.:format) posts#destroy
blogs GET /blogs(.:format) blogs#index
POST /blogs(.:format) blogs#create
new_blog GET /blogs/new(.:format) blogs#new
edit_blog GET /blogs/:id/edit(.:format) blogs#edit
blog GET /blogs/:id(.:format) blogs#show
PUT /blogs/:id(.:format) blogs#update
DELETE /blogs/:id(.:format) blogs#destroy
Using rails-froutes
with FILL_NAME
.
blog_posts GET /blogs/:blog_id/posts(.:format) posts#index
blog_posts POST /blogs/:blog_id/posts(.:format) posts#create
new_blog_post GET /blogs/:blog_id/posts/new(.:format) posts#new
edit_blog_post GET /blogs/:blog_id/posts/:id/edit(.:format) posts#edit
blog_post GET /blogs/:blog_id/posts/:id(.:format) posts#show
blog_post PUT /blogs/:blog_id/posts/:id(.:format) posts#update
blog_post DELETE /blogs/:blog_id/posts/:id(.:format) posts#destroy
blogs GET /blogs(.:format) blogs#index
blogs POST /blogs(.:format) blogs#create
new_blog GET /blogs/new(.:format) blogs#new
edit_blog GET /blogs/:id/edit(.:format) blogs#edit
blog GET /blogs/:id(.:format) blogs#show
blog PUT /blogs/:id(.:format) blogs#update
blog DELETE /blogs/:id(.:format) blogs#destroy
Installation
Add this line to your application's Gemfile:
gem 'rails-froutes'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rails-froutes
Usage
- Install
rails-froutes
(See Installation section) - Run
rake routes FILL_NAME=yes
Supported versions
- Ruby: 1.9.3, 2.0.0, 2.1.x, 2.2.x
- Rails: 3.2.x, 4.0.x, 4.1.x, 4.2.x
Contributing
- Fork it ( https://github.com/pinzolo/rails-froutes/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Changelog
- v1.0.0 (2014-08-14 JST): First release