Skip to content
New issue

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

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

Already on GitHub? # to your account

Missing route name on aliased CRUD actions #34

Closed
vlad-pisanov opened this issue Aug 7, 2023 · 4 comments · Fixed by #35
Closed

Missing route name on aliased CRUD actions #34

vlad-pisanov opened this issue Aug 7, 2023 · 4 comments · Fixed by #35
Assignees
Labels
bug Something isn't working

Comments

@vlad-pisanov
Copy link

Consider this routing (update is aliased as change):

resources :invitations do
  collection do
    put :update, as: :change
  end
end

Chusaku annotates the update action like so (change_invitation is present, but the standard invitation is missing):

# @route PUT /invitations (change_invitations)
# @route PATCH /invitations/:id
# @route PUT /invitations/:id
def update; end

Strangely, if I change it to resources :invitations, only: [:update], everything works as expected: 🤔

# @route PUT /invitations (change_invitations)
# @route PATCH /invitations/:id (invitation)
# @route PUT /invitations/:id (invitation)
def update; end
@nshki
Copy link
Owner

nshki commented Aug 7, 2023

Thanks for reporting this, @vlad-pisanov! I was able to reproduce what you described, and it does indeed seem to be a bug. I'll spend more time on this and will keep this thread updated.

@nshki nshki self-assigned this Aug 8, 2023
@nshki nshki added the bug Something isn't working label Aug 8, 2023
@nshki
Copy link
Owner

nshki commented Aug 8, 2023

@vlad-pisanov would you mind giving this potential fix a try?

  1. Change your Gemfile so you're temporarily pointing to the fix branch:

      gem "chusaku", git: "https://github.com/nshki/chusaku.git", branch: "fix/missing-route-names", require: false
  2. Run bundle install.

  3. Run bundle exec chusaku.

Does that give expected output?

@nshki nshki closed this as completed Aug 8, 2023
@nshki nshki reopened this Aug 8, 2023
@vlad-pisanov
Copy link
Author

@nshki it works! 🙌 No regressions either (tested on a very large codebase with thousands of routes)

@nshki
Copy link
Owner

nshki commented Aug 8, 2023

Fantastic! Thanks for verifying. 😄 Will be releasing a patch shortly!

@nshki nshki closed this as completed in #35 Aug 8, 2023
nshki added a commit that referenced this issue Aug 8, 2023
# Issue

Fixes #34.

# Overview

This PR fixes an issue where Chusaku doesn't annotate a name for a route
even when its path has one.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants