2011-12-29 75 views
0

我意外地生成了一個單獨的控制器comm_log沒有's'。 's'被添加到控制器名稱,助手,視圖,規格和路線。 customer_comm_log_path(f.customer_id,f.id)似乎不正確。有沒有辦法在rails 3.1中修復單個控制器?

該關係是一個通信日誌屬於一個客戶和一個客戶有很多通信日誌。

resources :customers do 
    resources :comm_logs 
    end 

耙路線(相關)的輸出是:

  comm_logs_index GET /comm_logs/index(.:format)          {:controller=>"comm_logs", :action=>"index"} 
      comm_logs_new GET /comm_logs/new(.:format)          {:controller=>"comm_logs", :action=>"new"} 
     comm_logs_create GET /comm_logs/create(.:format)          {:controller=>"comm_logs", :action=>"create"} 
      comm_logs_show GET /comm_logs/show(.:format)          {:controller=>"comm_logs", :action=>"show"} 
     comm_logs_destroy GET /comm_logs/destroy(.:format)         {:controller=>"comm_logs", :action=>"destroy"} 

     customer_comm_logs GET /customers/:customer_id/comm_logs(.:format)      {:action=>"index", :controller=>"comm_logs"} 
         POST /customers/:customer_id/comm_logs(.:format)      {:action=>"create", :controller=>"comm_logs"} 
    new_customer_comm_log GET /customers/:customer_id/comm_logs/new(.:format)     {:action=>"new", :controller=>"comm_logs"} 
    edit_customer_comm_log GET /customers/:customer_id/comm_logs/:id/edit(.:format)   {:action=>"edit", :controller=>"comm_logs"} 
     customer_comm_log GET /customers/:customer_id/comm_logs/:id(.:format)     {:action=>"show", :controller=>"comm_logs"} 
         PUT /customers/:customer_id/comm_logs/:id(.:format)     {:action=>"update", :controller=>"comm_logs"} 
         DELETE /customers/:customer_id/comm_logs/:id(.:format)     {:action=>"destroy", :controller=>"comm_logs"} 

有沒有辦法來解決奇異控制器?謝謝。

回答

1

嘗試script/destroy your_controller_name使用與創建它相同的控制器名稱。

+0

除了摧毀生成的一個,有沒有辦法解決它?或者修復它並不是一個好主意。 – user938363 2011-12-29 02:50:13

+0

銷燬/重做可能是處理這個問題的簡單方法。 – user938363 2012-01-03 17:32:08

+0

我同意user938363,最好是摧毀並重做。一如既往,在銷燬之前保存一份副本。這樣做(破壞者)也是一個好主意,因爲它刪除了測試存根等,否則通常會「擱置」 – 2012-01-03 21:26:56

相關問題