Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handle prices #478

Open
nymous opened this issue Nov 28, 2024 · 1 comment
Open

Better handle prices #478

nymous opened this issue Nov 28, 2024 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@nymous
Copy link
Member

nymous commented Nov 28, 2024

When creating an article or a subscription offer, we ask the admin for a price in decimal euros (5.00€), but we save it as cents in the DB (500). This avoids floating point errors when computing.
However because of this duality (form has a price but we save a price_cents), validation errors are hard to surface.

We could use Money and its Rails integration Money-Rails, to handle all the heavy lifting, validation...

@nymous nymous added bug Something isn't working good first issue Good for newcomers labels Nov 28, 2024
@D0gmaDev
Copy link
Member

The gem seems to go way beyond what's needed, but I believe it's crucial for lea5 to be reliable as for money, therefore I support @nymous 's proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants