Class: Currency

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
ActionView::Helpers::AutoTagHelper::FormInfo, ActiveRecord::Mlang
Defined in:
app/models/currency.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](iso_code) ⇒ Object



15
16
17
# File 'app/models/currency.rb', line 15

def self.[](iso_code)
  self.find_by(iso_code: iso_code.to_s.strip)
end

Instance Method Details

#__display__Object



11
12
13
# File 'app/models/currency.rb', line 11

def __display__
  self.name
end

#add_nation(code) ⇒ Object



19
20
21
22
23
24
25
# File 'app/models/currency.rb', line 19

def add_nation(code)
  if nid = Nation[code].try(:id)
    CurrencyNationMap.find_or_create_by(currency_id: self.id, nation_id: nid)
  else
    nil
  end
end