有没有办法在rails 3.1中修复单个控制器?

时间:2011-12-29 01:50:57

标签: ruby-on-rails ruby-on-rails-3.1

我意外地生成了一个没有's'的奇异控制器comm_log。 's'被添加到控制器名称,帮助程序,视图,规范和路由中。 customer_comm_log_path(f.customer_id,f.id)似乎不对。

关系是一个comm日志属于一个客户,一个客户有很多comm日志。

  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 个答案:

答案 0 :(得分:1)

使用用于创建它的相同控制器名称尝试script/destroy your_controller_name