Hi guys. My Property model has a “price” attribute, which is an
integer. When creating a property, I’d like users to be able to submit
“$1234” as the price, and have my app remove the “$”.
I thought this could be accomplished by having a before_validation
callback on the “price” attribute remove the “$”. Unfortunately, by
the time the callback is executed, the submitted price has been cast
to a Fixnum. This means that any price beginning with a “$” is
converted to 0 (zero).
Does anyone have any suggestions for how to do this?