samedi 4 février 2017

Rails add a from one controller to another controller

on a checkout controller if the user did not fill their address he can be redirected to the address path, but after the redirect rails spitting out

undefined method `new_user_address_path' for #

the checkout

def checkout
    @order = current_user.cart.orders.find(params[:id])
    if current_user.address.blank?
      redirect_to new_user_address_path(current_user)
      flash[:error] = 'Antes de prosseguir por favor, preencha o seu endereço'
    end
  end

i added a helper method but did not worked. why, the controller is warning the path as a method?

Aucun commentaire:

Enregistrer un commentaire