Есть ли способ исправить единственный контроллер в рельсах 3.1? - PullRequest
0 голосов
/ 29 декабря 2011

Я случайно сгенерировал отдельный контроллер comm_log без 's'. 's' был добавлен к имени контроллера, помощникам, представлениям, спецификациям и маршрутам. Customer_comm_log_path (f.customer_id, f.id) кажется не правильным.

Отношение - это журнал сообщений, принадлежащий клиенту, и у клиента есть много журналов сообщений.

  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 Ответ

1 голос
/ 29 декабря 2011

Попробуйте script/destroy your_controller_name, используя то же имя контроллера, которое использовалось для его создания.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...