ruby on rails - routing error showing that No route matches [POST] "/admin/locations/1" -
When I edit my location, I'm new to ROR, it will give me the following error Here I am using Rail 3.2.12 This is My Location Controller this is my edit.html.erb And this is my route. RB and in my index.html.erb & lt;% = link_to ("edit", {: action = & gt; 'edit' ,: id = & gt; location.id } ,: class = & gt; BTN BTN-info ')%> No [POST] "/ Admin / places / 1"
class admin :: Location controller & lt; ApplicationController def index @ location = location.order ("location desc") end DEF New @ location = location. Make new end DEIF @ location = location.NEW (PARAM [: location]) if @ location.save # flash [: notice ] = 'Successfully added to the location list.' Redirect_to: Action => 'Index' and render: action = & gt; 'New' end end def edit @location = location.find (params [: id]) end def update @location = location.find (params [: id]) if @ location.update_attributes (param [: location]) #flash [: Notice] = 'The category has been successfully updated.' Redirect_to: Action => 'Index' and render: action = & gt; 'Index' end and end
& lt; H2 & gt; Edit Location & lt; / H2 & gt; & Lt;% = simple_form_for (: location ,: url = & gt; {: action = & gt; 'update',: id = & gt; @ location.id}) do | F | & Gt%; & Lt;% = Render (: partial = & gt; 'form' ,: local = & gt; {: f = & gt; f})%> & Lt;% = submit_tag ("Update",%) & Lt;% = link_to ("cankal", {: action => 'index'})%> & Lt;% end% & gt;
GuestHouse :: application.routes.draw Please devise_for: Customer name: Administrator resource: End of locations < / Code>
<% = simple_form_for (: location :: url = & gt; Action = & gt; 'update' ,: id = & gt; @ location.id} ,: method = & gt; 'put') f | F | & Gt%; Pass the method in
simple_form_for
Comments
Post a Comment