Skip to content

Related route name conflicts with class_name in 0.9.7 #1251

@reidab

Description

@reidab

This issue is a (choose one):

  • Problem/bug report.
  • Feature request.
  • Request for support. Note: Please try to avoid submitting issues for support requests. Use Gitter instead.

Checklist before submitting:

  • I've searched for an existing issue.
  • I've asked my question on Gitter and have not received a satisfactory answer.
  • I've included a complete bug report template. This step helps us and allows us to see the bug without trying to reproduce the problem from your description. It helps you because you will frequently detect if it's a problem specific to your project. (this didn't seem to exist in the 0.9 branch)
  • The feature I'm asking for is compliant with the JSON:API spec.

Description

Bug reports:

I ran into some route name collisions after the 0.9.7 upgrade:

Given a List model with has_many :items, class_name: 'ListItem'
and a ListResource with has_many :items, class_name: 'ListItem'
and a ListItem model
and a ListItemResource:

The route for the items relationship on ListResource (to list_items#get_related_resources) is generated as list_items, which conflicts with the index route for ListItemResource (to list_items#index). Since there's no explicit name given for the ListItems resource route, this causes list_items_path to attempt to generate the route to list_items#get_related_resources and fail because it's missing required params.

It seems like this could be solved by adding a scope to the related route names similar to the one used for the in the relationships routes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions