Class: ActiveCurrency::DatabaseStore
- Inherits:
-
Object
- Object
- ActiveCurrency::DatabaseStore
- Defined in:
- lib/active_currency/database_store.rb
Overview
Currency Store that uses our ActiveRecord model to save and retrieve a value.
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#add_rate(from, to, rate, date = nil) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/active_currency/database_store.rb', line 11 def add_rate(from, to, rate, date = nil) ActiveCurrency::Rate.create!( from: from, to: to, value: rate, created_at: date || Time.zone.now ) end |
#get_rate(from, to, date = nil) ⇒ Object
7 8 9 |
# File 'lib/active_currency/database_store.rb', line 7 def get_rate(from, to, date = nil) ActiveCurrency::Rate.value_for(from, to, date) end |