Optimize Exchange Flow

  Kiến thức lập trình

im actually working in ruby on rails and im watching methods that convert values according to specific exchange rate.
For example, for each value of an account, it makes the following execution:

@accounts.examplevalue = @params["examplevalue"].to_f * currency_exchange_rate.to_f

And “currency_exchange_rate” is calculated according to different ways, like taking the exchange rate from database instead of api calls or excel upload.

My question is: do you know other ways that can optimize the full process without moltiply each single value for “currency_exchange_rate”? Maybe like calling ‘@accounts.examplevalue_converted’?
Thanks

LEAVE A COMMENT