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

restrict auto-generated routes #276

Open
deniciocode opened this issue Jul 21, 2016 · 3 comments
Open

restrict auto-generated routes #276

deniciocode opened this issue Jul 21, 2016 · 3 comments

Comments

@deniciocode
Copy link

If a controller inherits from another controller and uses some action from the super class, rails_best_practice does not recognize the inheritance and says restrict auto-generated routes.

Example

class ChildsController < ParentsController
  def update
  end  

  def destroy
  end
end

And the parent class

class ParentsController < ApplicationController
  def new
  end

  def create
  end

  def edit
  end

  def update
  end

  def destroy
  end
end

This will output restrict auto-generated routes parents/childs (only: [:update, :destroy])

@tomoyuki28jp
Copy link

I'm having the same issue for my mountable engine.

module Admin
  class UsersController < ApplicationController
    def edit
    end

    def update
    end
  end
end

# => restrict auto-generated routes users (only: [:edit, :update])

@samrjenkins
Copy link

It would seem the same issue exists for actions included through a concern:

module EditUpdatePatientEmailConcern
  extend ActiveSupport::Concern

  def edit
  end

  def update
  end
end
module Practitioners
  class PatientsController < PractitionersApplicationController
    include EditUpdatePatientEmailConcern
  end
end

rails_best_practices will complain so:
restrict auto-generated routes practitioners/patients (only: [])

@rwojnarowski
Copy link
Contributor

Same issue with autogenerated routes from Administrate gem https://github.com/thoughtbot/administrate

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

4 participants