flyerhzm/rails_best_practices — Issue #65: restrict auto-generated routes
Author: zedtux
Created: 2011-10-14 18:51:08+00:00
State: open

Following what was described at http://rails-bestpractices.com:

Given my Rails(3.1.0) routes.rb file:

````ruby
EventsServer::Application.routes.draw do

# Register an application and appication events
resources :registrations, only: [:index, :show, :create]

# Register subscriptions to application events
resources :applications, shallow: true, only: [:index, :show, :create] do
resources :events, only: [:index, :show, :create, :subscribe, :push] do
member do
post "subscribe"
post "push"
end
resources :executions, only: [:index, :show] do
resources :execution_statuses, only: :index
end
end
end

root to: 'applications#index'

end
````

When I execute `rails_best_practices`
Then I see:

````bash
Analyzing: 100% |oooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00
./config/routes.rb:14 - needless deep nesting (nested_count > 2)
./config/routes.rb:7 - restrict auto-generated routes (:only => [:index, :create])
./config/routes.rb:13 - restrict auto-generated routes (:only => [:index])

Please go to http://rails-bestpractices.com to see more useful Rails Best Practices.

Found 3 warnings.
````

It report me that routes.rb line 7 and 13 has restrict auto-generated routes. And yes it has !
I don't understand what's going wrong here. Please help ? :)