ROR を初めて使用するのですが、場所を編集すると次のエラーが表示されます
No route matches [POST] "/admin/locations/1"
ここで私はレール3.2.12を使用しています
これが私のロケーションコントローラーです
class Admin::LocationsController < ApplicationController
def index
@location= Location.order("location desc")
end
def new
@location=Location.new
end
def create
@location = Location.new(params[:location])
if @location.save
# flash[:notice] = 'Location is successfully added in to list.'
redirect_to :action => 'index'
else
render :action => 'new'
end
end
def edit
@location = Location.find(params[:id])
end
def update
@location = Location.find(params[:id])
if @location.update_attributes(params[:location])
#flash[:notice] = 'Category is successfully updated.'
redirect_to :action => 'index'
else
render :action => 'index'
end
end
end
これは私の edit.html.erb です
<h2>Edit Location</h2>
<%= simple_form_for(:location, :url => {:action => 'update', :id => @location.id}) do |f| %>
<%= render(:partial => 'form', :locals => {:f => f}) %>
<%= submit_tag("Update",) %> <%= link_to("cancle", {:action => 'index'} )%>
<%end%>
これは私のroute.rbです
GuestHouse::Application.routes.draw do
devise_for :customers
namespace :admin do
resources :locations
end
そして私の index.html.erb では <%= link_to("Edit", {:action => 'edit', :id => location.id}, :class => 'btn btn-info')%> として