Skip to content

Fix duplicate shallow routes - #129

Open
visini wants to merge 1 commit into
skryukov:mainfrom
visini:fix-shallow-duplicate-routes
Open

visini wants to merge 1 commit into
skryukov:mainfrom
visini:fix-shallow-duplicate-routes

Conversation

@visini

@visini visini commented Sep 6, 2026

Copy link
Copy Markdown

With something like this...

Rails.application.routes.draw do
  resources :teams, only: [] do
    resources :comments, only: [:show, :update], shallow: true
  end
  resources :groups, only: [] do
    resources :comments, only: [:show, :update], shallow: true
  end
end

... I saw that it generates two updates in the controller.

Before:

comment: ...  // GET /comments/:id
update:  ...  // PATCH /comments/:id
show:    ...  // GET /comments/:id
update:  ...  // PATCH /comments/:id <- Duplicate

After:

show:   ...   // GET /comments/:id
update: ...   // PATCH /comments/:id

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

Successfully merging this pull request may close these issues.

1 participant