Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Merge requests
  • !1909

Rely on Rails' `route` method to be correct

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Nick Charlton requested to merge nc-always-route into master Feb 15, 2021
  • Overview 1
  • Commits 1
  • Pipelines 0
  • Changes 3

Previously, we were searching for a routes.rb to verify that we'd already added the routes or not. We don't need to do this: the route method will only ever inject into the config/routes.rb file it knows about — so us looking elsewhere would never make a difference to the outcome of the generator.

On top of this, the route method in turn leans on inject_into_file from Thor which is configured to not force the result.

So, much of this can go. We just continue to check that we don't generate routes with no models.

https://github.com/rails/rails/blob/291a3d2ef29a3842d1156ada7526f4ee60dd2b59/railties/lib/rails/generators/actions.rb#L269 https://github.com/erikhuda/thor/blob/34df888d721ecaa8cf0cea97d51dc6c388002742/lib/thor/actions/inject_into_file.rb#L26

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: nc-always-route