Sha256: 39ea4a57c434f35251f34763d2f4a3ccff6a140b388c096c69ae6f8612979d5a
Contents?: true
Size: 497 Bytes
Versions: 4
Compression:
Stored size: 497 Bytes
Contents
module Danconia module Stores class ActiveRecord def save_rates rates ExchangeRate.transaction do rates.each do |pair, rate| ExchangeRate.where(pair: pair).first_or_initialize.update rate: rate end end end def direct_rate from, to ExchangeRate.find_by(pair: [from, to].join)&.rate end def rates ExchangeRate.all end end class ExchangeRate < ::ActiveRecord::Base end end end
Version data entries
4 entries across 4 versions & 1 rubygems