couriers freight gem

1

Hello, I'm using this calculation in the controller but when I put <%= @pac %> or <%= @sedex %> in the view is not showing the value, is someone 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
    
asked by anonymous 19.03.2015 / 20:36

1 answer

0

The problem is that you're doing redirect_to at the end. This causes a new request to be made to the server and the values are lost. You need to substitute something like render 'checkout' .

    
20.03.2015 / 12:47