Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive: restrict auto-generated routes using resources with concern #345

Open
JuanfraM opened this issue Jan 3, 2019 · 0 comments

Comments

@JuanfraM
Copy link

JuanfraM commented Jan 3, 2019

Hi,
I'm using rails 5.1.5 and rails_best_practices 1.16.0.
I'm trying to use resources with a concern in the routes.rb but I'm having this error:

restrict auto-generated routes (only: [])

This is the code that generates the error with the concern in the resources groceries:

concern :shopper_actions do
   scope module: :shops do
        member do
          resources :orders, only: :index
       end
   end
end

namespace :shoppers do
  resources :groceries, param: :shop_id, controller: 'shops', only: :index,
                                       concerns: :shopper_actions
end

and this is the code that works fine without the concern:

namespace :shoppers do
  resources :groceries, param: :shop_id, controller: 'shops', only: :index do
     scope module: :shops do
         member do
            resources :orders, only: :index
          end
      end
   end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant