lundi 15 mai 2017

Rails why undefined local variable or method `new_dispute' for #

i added dispute new link inside orders but rails log shows

since the dispute is associated with order in the model why still show undefined local variable or method?

undefined local variable or method `new_dispute' for

<#

someone know why?

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

Aucun commentaire:

Enregistrer un commentaire