flyerhzm/rails_best_practices

RestrictAutoGeneratedRoutesCheck for rails API only: false positive

terry90 opened this issue · 1 comments

xxx/config/routes.rb:4 - restrict auto-generated routes model1 (except: [:new, :edit])
xxxi/config/routes.rb:5 - restrict auto-generated routes model2 (except: [:new, :edit])

Well, it shouldn't warn for this:

rake routes

                candidates GET        /candidates(.:format)                                candidates#index
                           POST       /candidates(.:format)                                candidates#create
                 candidate GET        /candidates/:id(.:format)                            candidates#show
                           PATCH      /candidates/:id(.:format)                            candidates#update
                           PUT        /candidates/:id(.:format)                            candidates#update
                           DELETE     /candidates/:id(.:format)                            candidates#destroy

When providing config.api_only = true in config/application.rb, Rails won't generate new and edit

@terry90 it's fixed