-1

I have nested routes that I'm having difficulty formatting the way I want to. My routes.rb has the following

resource :loan_application do
  scope ":loan_application_id" do
    resources :wizard, only: [:show, :update]
  end
end

When I click the link to create a new resource:

<%= link_to business_loan_application_path(@user), method: :post %>

I get sent to a URL that looks like the following

http://localhost:3000/businesses/69/163/loan_application/wizard/eligibility

For some reason the loan_id (163) comes before /loan_application. I would like it to come after /loan_application.

When I rake routes I can see the same problem:

 business_loan_application_wizard GET    /businesses/:business_id/:loan_application_id/loan_application/wizard/:id(.:format) wizard#show
Questifer
  • 1,113
  • 3
  • 18
  • 48

1 Answers1

0

In my application I made the routes without your scope:

resources :loan_application do
  resources :wizard, only: [:show, :update]
end

That leads me into exact the pathes I need

Klaus
  • 1,591
  • 1
  • 12
  • 18
  • Making it resources :loan_applications did the trick. If you want to modify the answer I will mark as correct. Thanks – Questifer Mar 06 '15 at 17:14
  • Yeah, sometimes it's better to read letter by letter ;) I've edit my post, of course it must be resources in the first line. But I'm not quite sure about your _:loan_applications_ , because the there is a difference between loan_application_wizard_path and loan_applications_wizard_path. – Klaus Mar 06 '15 at 19:56