0
When using the controller name in the singular, the path is prefixed with _index
at the end of the route name (ex. dispute_conference_index
). Inside the controller in the method create
the parameter location
in render
receives the registration URL.
Unfortunately the name passed to location
is dispute_conference_url
instead of dispute_conference_index
.
See below the route configuration I’m using:
resources :disputes, shallow: true do
scope module: :dispute do
resources :conference, except: :index
end
end
See the details of Routes:
Prefix Verb URI Pattern Controller#Action
conferences GET /conferences(.:format) conferences#index {:format=>:json}
dispute_conference_index POST /disputes/:dispute_id/conference(.:format) dispute/conference#create {:format=>:json}
conference GET /conference/:id(.:format) dispute/conference#show {:format=>:json}
PATCH /conference/:id(.:format) dispute/conference#update {:format=>:json}
PUT /conference/:id(.:format) dispute/conference#update {:format=>:json}
DELETE /conference/:id(.:format) dispute/conference#destroy {:format=>:json}
PUT /conference/:id/start(.:format) dispute/conference#start {:format=>:json}
PUT /conference/:id/cancel(.:format) dispute/conference#cancel {:format=>:json}
PUT /conference/:id/finish(.:format) dispute/conference#finish {:format=>:json}
What is the correct way to correct this question, passing the location
correct?
Correcting the question: The reason for the error is because of the parameter shallow: true
, it alters the path
routes requiring manual intervention or through a function (url_path).
When trying to rotate the method create
an error will be obtained as it will not be possible to find the location
.
Adding statically is not a good idea...
location: :dispute_conference_index
– Bruno Wego