class Devise < ActiveRecord::Base

  def self.convert(amount, devise_from, devise_to)
    result = (amount.to_f/devise_from.rate)*devise_to.rate
    
    return result.round(2)
    
    #Devise.convert(10, Devise.find_by_code("EUR"), Devise.find_by_code("USD"))
    #Devise.convert(10, Devise.find_by_code("USD"), Devise.find_by_code("EUR"))
    #Devise.convert(10, Devise.find_by_code("CHF"), Devise.find_by_code("EUR"))
  
  end

end
