You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the next major release we should look into changing money_column to support a single currency. Rather than both currency and currency_column, we could have only currency and make it accept something responding to call or to_s.
Example:
class Product
money_column :price, currency: ->(product) { product.currency }
money_column :price_usd, currency: 'USD'
end
I think this is easier to reason about and will help clean up the code
I'm having a bit of deja vu 😄 we've had a similar discussion in the past: passing a symbol would refer to a method/attribute and a string would mean a hardcoded currency. We opted for the current solution with the currency_column and currency keyword arguments at the time.
I agree the money_column should be nicer but I'm not convinced a lambda is worth the performance impact:
For the next major release we should look into changing money_column to support a single currency. Rather than both
currency
andcurrency_column
, we could have onlycurrency
and make it accept something responding tocall
orto_s
.Example:
I think this is easier to reason about and will help clean up the code
cc: @bdewater
The text was updated successfully, but these errors were encountered: