Sha256: f2ef15760030f161d527b5e4b38f71b5bf37ab93f12e69d5812a6bc9e2272bed

Contents?: true

Size: 663 Bytes

Versions: 4

Compression:

Stored size: 663 Bytes

Contents

module Killbill
  module CurrencyPlugin
    class CurrencyUpdate < ActiveRecord::Base

      has_many :currency_rates

      scope :historical_base_currencies, ->(base_currency_arg) { where("base_currency = ?", base_currency_arg).order("conversion_date DESC") }
      scope :latest_base_currency, ->(base_currency_arg) { historical_base_currencies(base_currency_arg).limit(1) }
      scope :distinct_base_currencies, -> { select("DISTINCT base_currency").order("base_currency ASC") }

      #scope :latest_rates_for_currency, ->(base_currency_arg) { latest_base_currency(base_currency_arg).joins(:currency_rates).order("target_currency ASC")  }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
killbill-currency-plugin-3.0.0 lib/currency_plugin/models/currency_update.rb
killbill-currency-plugin-2.0.0 lib/currency_plugin/models/currency_update.rb
killbill-currency-plugin-1.3.1 lib/currency_plugin/models/currency_update.rb
killbill-currency-plugin-1.3.0 lib/currency_plugin/models/currency_update.rb