2017-09-14 4 views
1

"exchange_to(:CLP).to_i"メソッドを使用すると、OrdersController#createにMoney :: Bank :: GoogleCurrencyFetchErrorというエラーが表示されます。 Money :: Bank :: GoogleCurrencyFetchErrorMoney :: Bank :: GoogleCurrencyFetchError

# class OrdersController < ApplicationController 
def create 
    @buying_methods = Order.buying_methods.keys 
    @shipping_type_clients = Order.shipping_type_clients.keys 
    @order = Order.new(order_params) 
    @order.dollar = Money.new(100, "USD").exchange_to(:CLP).to_i 
    @order.user = current_user 

    respond_to do |format| 
     if @order.save 
     if @order.cmm_buy? 
      @order.in_draft! 
     end 
     format.html { redirect_to "#{my_account_path}#my-orders", notice: 'El pedido se ha creado con éxito.' } 
     else 
     @order.products.build 
     format.html { render :new } 
     end 
    end 
    end 

# config/initializers/google_currency.rb 
require 'money' 
require 'money/bank/google_currency' 

# seconds after than the current rates are automatically expired (24 hours) 
Money::Bank::GoogleCurrency.ttl_in_seconds = 86400 

# set default bank to instance of GoogleCurrency 
Money.default_bank = Money::Bank::GoogleCurrency.new 

# config/initializers/ 
MoneyRails.configure do |config| 
    config.register_currency = { 
    :iso_code   => "US8", 
    :subunit_to_unit  => 100_000_000, 
    :thousands_separator => ".", 
    :decimal_mark  => "," 
    } 
end 
+0

は作業GoogleCurrency今日 – gok

答えて

4

設定/初期化/ money.rb

が一番上に次の行を追加します。

Money::Bank::GoogleCurrency::SERVICE_HOST="finance.google.com" 
+2

これは簡単な解決策ですが、3.4.0にアップグレードすると問題が解決します – Arvind

3

私たちは残念ながら.. reportedを持っており、応答を待っています。

new versiongoogle_currencyのように見えますが、この問題を解決する可能性があります。あなたのファイルで

+0

新しいバージョンと間違って何かがあります良い、ありがとう – Arvind

+1

宝石をアップグレードする3.4.0 –

関連する問題