Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix generation of second/subsequent resources in an extension #3372

Merged
merged 1 commit into from
May 25, 2018

Conversation

anitagraham
Copy link
Contributor

This PR changes the order of frontend routes generated when adding a second or subsequent route to an extension. See gitter discussion with jussihirvi on May 10.

The current routes generated by

generate refinery:engine place name:string
generate refinery:engine person  name:string --extension places --namespace places

are (with intervening lines removed)

  # Frontend routes
  namespace :places do
    resources :places, :path => '', :only => [:index, :show]
  end
  # Frontend routes
  namespace :places do
    resources :people, :only => [:index, :show]
  end

Trying to access /places/people results in "Couldn't find Refinery::Places::Place with 'id'=people", as routes are matched in the order defined.

With the changes the routes (with even more lines removed) become:

  namespace :places do
    resources :people, :only => [:index, :show]
    resources :places, :path => '', :only => [:index, :show]
  end

@parndt parndt merged commit 0473938 into refinery:master May 25, 2018
@bricesanchez bricesanchez added this to the 5.0 milestone Jul 27, 2018
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.

None yet

3 participants