In rails routes, Rails routes are matched in the order they are specified.
For example:
if you have resources:books above a get 'books/top ' the show action's route for the resources line will be matched before the get line.
To fix it:
move the get line above the resources line so that it is matched first.
In Model's association, the order of the association does matter.
For example:
has_many :model should be above has_many :items, through: :model.
Top comments (1)
This also gets tricky if you have nested routes in addition to full resources for one of those nested routes.