Closed chase-stevens closed 10 months ago
For these use cases I’ve been adding the _cents
columns using add_column
instead of using add_monetize
.
From my understanding you can also do add_monetize …, currency: false
, although it is not documented.
Thanks @sunny, appreciate it. In our RFC, we're recommending adding each column separately as our standard is to use one currency column per model. We do have some use cases where want a currency column for each attribute, but those are rarer.
Hi all 👋
I wanted to reach out in regards for the migration helper method
add_monetize
for the case where a record has a single attribute for currency and multiple different cents attributes.I'm able to set this up by adding integer columns for my
*_cents
attributes and a string column for mycurrency
attribute and using thewith_model_currency
argument withmonetize
in the model.I was wondering if there was more support or a more elegant way of going about this? Initially, I tried to use the
column_name
argument in the initializer for currency to set all currency columns generated byadd_monetize
to use the same column, but that resulted in a DuplicateColumn error. Would there be any interest in allowing for skipping creating duplicate columns if the column name argument is set?Thanks and please let me know if you have any questions.