Closed tfe closed 9 years ago
I understand the concept, but I'm not sure that this column naming is common practice - there are a handful of ruby projects on GitHub with _cents in the code, and not all of those are Rails related. Also, many currency don't use cents as the smallest unit, so I18n is a bit of a problem. Is there a way to make this more column name and currency agnostic?
Fair point; maybe it's best left to the app owner to customize for their use.
That being said, it might be a nice optional widget/partial to offer along the lines of the current progress_bar
. Locals could allow for a custom divisor, gsub string, and options to pass to number_to_currency
.
If you'd be interested in merging the associated PR with those modifications, I can make them.
Sounds reasonable. Do you plan to tackle editability at a later stage? - turning a read-write field into a read-only one just for display purposes strikes me as a slightly negative trade-off for an admin interface. (Appreciate it will be an optional partial.)
It would be nice to have a specialized attribute type for the common Rails practice of having a
foo_in_cents
orfoo_cents
column. Ideally it would:number_to_currency
Since 3 is much more complicated than 1 and 2, I propose first releasing a "money_cents" partial which does only 1 and 2, presenting the attribute as an un-editable field.