Sha256: 8b36a8ac841defa8c318a21c7d844a24b98663f9e9bfb35f1a94639b5959dea2

Contents?: true

Size: 466 Bytes

Versions: 2

Compression:

Stored size: 466 Bytes

Contents

class Currency < ActiveRecord::Base

  has_many :to_exchanges_rates, :class_name => 'CurrenciesExchangesRate', :foreign_key => :from_currency_id, :dependent => :destroy
  has_many :from_exchanges_rates, :class_name => 'CurrenciesExchangesRate', :foreign_key => :to_currency_id, :dependent => :destroy

  def self.default
    Currency.find_by_default(true)
  end

  def to_exchanges_rate(currency)
    to_exchanges_rates.find_by_to_currency_id(currency.id)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
forgeos_commerce-1.9.1.rc1 app/models/currency.rb
forgeos_commerce-1.9.0 app/models/currency.rb