-
Notifications
You must be signed in to change notification settings - Fork 34
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
Respect database precision #10
Comments
You mean: finding a way to bring the current database precision to show in the localized version of the attribute? Right now it uses the default precision in locale config, but that's something we could think about yeah. |
Yep, exactly! Take a look: |
Sorry, submitted without code: irb(main):002:0> publicity.value
=> #<BigDecimal:7f8e7bf4cc00,'0.30015E2',18(18)>
irb(main):003:0> publicity.value.to_s
=> "30.015"
irb(main):004:0> publicity.localized.value
=> "30,02" But I'm expecting this: irb(main):006:0> helper.number_with_precision publicity.value, :precision => 3
=> "30,015" |
Got it.. sounds reasonable to me yeah, will make our life easier. Just need to figure out a good way to handle the case, because parsing / localizing is untied from column lookup. I have to finish and merge some other stuff onto master, then I'll try to look this, thanks! |
Hi, Any news on this? If you point me the direction I can work in a PR. |
@fernandoluizao no news, sorry - I have to circle back and review this more carefully, it seems to make sense to respect that option, but I'm not sure how it'll conflict with the locale yet. If you have some time to play with it, please feel free to go ahead :). Thanks! |
Hi mate :)
We are working in a project that have a lot of decimal columns with different precisions.
Currently we are workarounding with decorators:
I think where we want to display a different precision is where we should implement something like decorators to override precision.
What you think?
The text was updated successfully, but these errors were encountered: