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

Generate routes in the right order #4

Closed
mtearle opened this issue Sep 15, 2016 · 2 comments
Closed

Generate routes in the right order #4

mtearle opened this issue Sep 15, 2016 · 2 comments
Assignees

Comments

@mtearle
Copy link

mtearle commented Sep 15, 2016

Not sure if this is a bug or not.

The scaffold generated the routes in the wrong order and I was seeing similar errors to this StackOverflow post. (and chased my tail for about an hour)
http://stackoverflow.com/questions/35587497/activerecordrecordnotfound-couldnt-find-id-new

Fixing the ordering of routes as suggested by the comment fixed things

--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,13 +1,13 @@
 Rails.application.routes.draw do
-  resources :registrations, only: [:create, :show] do
-    resources :registration_steps, only: [:edit, :update]
-  end
-
   resources :registrations
   post 'logins/create'
   get 'sessions/create'
   delete 'sessions/destroy'

+  resources :registrations, only: [:create, :show] do
+    resources :registration_steps, only: [:edit, :update]
+  end
+
@AndyObtiva
Copy link
Owner

Good thing you stumbled on an answer in StackOverflow.

I just ran and got this:

  resources :projects, only: [:create, :show] do
    resources :project_steps, only: [:edit, :update]
  end

  resources :projects

I think the main issue is that resources :projects is repeating twice, once filtered (create and show only) and the other time unfiltered. It must only exist once whether filtered or not.

Thanks for reporting. I will look into fixing this by avoiding the redundant route.

The good news either way is that Ultra Light Wizard is now covered end-to-end by feature tests (acceptance tests) and it succeeds regardless of the reported route issue.

@AndyObtiva
Copy link
Owner

Fixed as per commit c7a951d

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

No branches or pull requests

2 participants