mercredi 24 mai 2017

Rails undefined method `update_attributes' for false:FalseClass

If the dispute save the change the order boolean false to true but after create the rails log show

undefined method `update_attributes' for false:FalseClass

Someone know why?

order 
has_one :dispute

dispute
belongs_to :order


def create
    if   current_user == @order.buyer



      dispute = @order.dispute.nil? ? Dispute.new : @order.dispute

      if dispute.save
@order = params[:dispute_status] == "1"

         @order.update_attributes(:dispute_status => true

        redirect_to order_dispute_path(@order, @dispute)
        flash[:success] = 'yess'

      else
        flash[:error] = 'Erro'
        redirect_to :back
      end
    end
  end

Aucun commentaire:

Enregistrer un commentaire