ruby on rails - No route matches [POST] "/author/test_author/24/steps_author/13" -
i have form work , not , can't work out changing between times, other restarting rails app. isn't working.
i have these entries in routes file:
constraints :subdomain => 'my' namespace 'my', path: nil namespace 'author' resources :test_author resources :steps_author [...] end end end end
the particular routes i'm interested in here produce rake routes
my_author_test_author_steps_author /author/test_author/:test_author_id/steps_author/:id(.:format) my/author/steps_author#show {:subdomain=>"my"} put /author/test_author/:test_author_id/steps_author/:id(.:format) my/author/steps_author#update {:subdomain=>"my"} delete /author/test_author/:test_author_id/steps_author/:id(.:format) my/author/steps_author#destroy {:subdomain=>"my"}
my form opening looks (using simple form , bootstrap):
<%= simple_form_for @step, :url => my_author_test_author_steps_author_path(@step), :html => { :class => 'form-horizontal' } |f| %>
can shed light on happening?
update
based on juanpastas seems form rendering correctly rails interpreting request post , not put. though life of me can't work out why.
you need pass complete params in route
<%= simple_form_for @step, :url => my_author_test_author_steps_author_path(author, @step), :html => { :class => 'form-horizontal' } |f| %>
after reading title see should making post /author/test_author/24/steps_author/
without last number. about:
<% url = !@step.persisted? ? '/author/test_author/24/steps_author/' : my_author_test_author_steps_author_path(author, @step) %> <%= simple_form_for @step, :url => url, :html => { :class => 'form-horizontal' } |f| %>
i have harcoded route because not sure route helper name. can run rake routes
find helper.
Comments
Post a Comment