freight couriers

Asked

Viewed 304 times

1

Hello, I am using this calculation in the controller but when I put <%= @pac %> or <%= @sedex %> in the view is not showing the value, someone is having the same problem?

grateful

def calculate_ship
frete = Correios::Frete::Calculador.new :cep_origem => "23970-000",
:cep_destino => params[:post_code]
servicos = frete.calcular :sedex, :pac
@pac = servicos[:pac].valor
@sedex = servicos[:sedex].valor
redirect_to checkout_order_path
end

1 answer

0


The problem is you’re making one redirect_to at the end. This causes a new request to be made to the server and the values are lost. You need to replace it with something like render 'checkout'.

  • that’s right, thanks for the tip Gui.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.