Rails 为什么 #<#<Class:0x007fec13d18678> 未定义局部变量或方法 `new_dispute'

Rails why undefined local variable or method `new_dispute' for #<#<Class:0x007fec13d18678>

我在订单中添加了新的争议 link 但 rails 日志显示

既然争议与模型中的顺序有关,为什么仍然显示未定义的局部变量或方法?

undefined local variable or method `new_dispute' for

<#

有人知道为什么吗?

view/_order.html.erb

        <ul>
     <li>Order: <b><%= order.transaction.transaction_id %></b></li>
      <li>seller:<%= order.seller_name %></li>
 <li><%=link_to"Create New Dispute", new_dispute %></li>
</ul>

disputer controller


class DisputesController < ApplicationController

  def new
    @order = current_user.cart.orders.find(params[:id])
    if current_user.address.blank?
      redirect_to edit_user_path
      flash[:error] = 'error'
    else
      @dispute = Dispute.new
    end
  end 
end

class Order < ActiveRecord::Base

  has_one :dispute


end


class Dispute < ActiveRecord::Base
  # attr_accessible :title, :body


  belongs_to :order
'

end

尝试new_dispute_path

并在此处阅读所有相关内容 :)

http://guides.rubyonrails.org/routing.html#path-and-url-helpers