2010-10-25 43 views
0

我得到一個路由錯誤:沒有路由匹配「/ deccom_tasks /更新/ 1」 {:方法=>:把}的Rails:路由更新錯誤

我不知道爲什麼我收到一個路由通常工作的路線錯誤。

路線:

map.resources :decom_tasks, :collection => {:sort => :post, :deactivate_task => :get, :reactivate_task => :get} 

控制器:

def update 
    @task = Task.find(params[:id]) 

    respond_to do |format| 
     if @task.update_attributes(params[:task]) 
     format.html { redirect_to(@task, :notice => 'Task was successfully updated.') } 
     format.xml { head :ok } 
     else 
     format.html { render :action => "edit" } 
     format.xml { render :xml => @task.errors, :status => :unprocessable_entity } 
     end 
    end 
    end 
+0

將有事可做的事實, '任務' 是一個模型,那麼有一個任務控制器,一個decom_task控制器和一個com_task控制器? – Rumpleteaser 2010-10-25 01:42:52

+1

你的錯誤說'deccom',而你的路線說'decom' – 2010-10-25 01:48:16

+0

你會在更新之前或之後得到錯誤。路線通常是這樣的'資源/ 1 /更新',而不是'資源/更新/ 1'不知道爲什麼 – s84 2010-10-25 01:49:16

回答