0

我的路线包含以下内容:

namespace :admin do
    resources :retailers
    resources :drop_ship_orders do
      collection  do
        post :edit_individual
        put  :update_individual
      end
      member do
        put :fire
        get :fire
        post :resend
      end
   end
end

我的观点包含:

<%= form_tag edit_individual_drop_ship_orders_path do %>
<table class="index" id='listing_orders'>
  <thead>
    <tr data-hook="admin_orders_index_headers">
      <th><%= check_box_tag('test') %></th>
      <% if @show_only_completed %>
        <th><%= sort_link @search, :completed_at, t("activerecord.attributes.order.completed_at") %></th>
      <% else %>
        <th><%= sort_link @search, :created_at,   t("order_date") %></th>
      <% end %>
      <th><%= sort_link @search, :number,         t("order_number") %></th>
      <th><%= sort_link @search, :state,          t("status") %></th>
      <th><%= sort_link @search, :shipment_state, t("shipment_state") %></th>
      <th><%= sort_link @search, :email,          t("customer") %></th>
      <th><%= sort_link @search, :total,          t("total") %></th>
      <th data-hook="admin_orders_index_header_actions"></th>
    </tr>
  </thead>
  <tbody>
  <% @orders.each do |order| %>
    <tr data-hook="admin_orders_index_rows">
      <td><%= check_box_tag "drop_ship_order_ids[]", order.id %></td>   
      <td><%= l (@show_only_completed ? order.order.completed_at : order.order.created_at).to_date %></td>
      <td><strong><%= order.order.number %></strong></td>
      <td><%= t("order_state.#{order.state.downcase}") %></td>
      <td><%#= link_to t("shipment_states.#{order.order.shipment_state}"), admin_order_shipments_path(order) if order.shipment_state %></td>
      <td><%= order.order.email %><br><%= order.order.ship_address.firstname%> <%= order.order.ship_address.lastname %><br><%= order.order.ship_address.phone %></td>
      <td><%= number_to_currency order.total %></td>
      <td class='actions' data-hook="admin_orders_index_row_actions">
        <%= button_link_to t(:process_order), edit_admin_drop_ship_order_url(order) unless order.completed?%>
      </td>
    </tr>
  <% end %>
  </tbody>
</table>
<%= will_paginate(@orders, :previous_label => "&#171; #{t('previous')}", :next_label => "#{t('next')} &#187;") %>
<%= submit_tag (t('multi_process')) %>
<% end %>

Rails 无法识别 edit_individual_drop_ship_orders_path

在我的控制器中,我添加了 edit_individual 操作。

我的错误:#<#:0x000001067314a8> 的未定义局部变量或方法`edit_individual_drop_ship_orders_path'

有人可以帮我吗?

谢谢

4

4 回答 4

1

当你遇到路由问题时要做两件事:1.重新启动服务器 2.检查rake routes

于 2011-07-21T16:17:41.793 回答
0

您添加了一个“管理员”命名空间,因此路径为:

admin_edit_individual_drop_ship_orders_path

您应该考虑切换到使用form_for虽然来编辑资源。

于 2011-07-21T16:09:32.797 回答
0

试试这个

       form_tag :url => admin_edit_individual_drop_ship_orders_path do

检查之前的路线

于 2011-07-21T16:08:22.287 回答
0
rake routes

上述命令解决了所有与路由相关的问题,以分析第 1 级的问题。

于 2014-01-31T15:49:09.037 回答