Validating currency when setting field #665
Unanswered
DanielPechersky
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an ActiveRecord that looks like
with a migration that looks like
I'd like to force the currency of CheckoutSession.total_amount to be USD so that if I do
CheckoutSession.create!(total_amount: Money.from_cents(100, "CAD"))
or
session.total_amount = Money.from_cents(100, "CAD")
I get an exception.
How would I go about doing this?
Beta Was this translation helpful? Give feedback.
All reactions