Best way to sanitize a decimal field (remove commas and $'s)

newNumber = number.gsub(/[^\d\.]/, '')

Or use gsub!

All the other methods don't account for stripping other garbage characters that people/exports might toss into strings. like () or - for negative nummbers.

Take the approach of extracting only what you want, not removing what you don't want.

"Balance: $ -(123,345.098) extra junk".gsub(/[^\d\.]/, '')

-- gw (

You can get the entered value directly via params[:event][:amount]

So for instance,
3. payment.amount = params[:event][:amount].gsub(/[^\d\.]/, '')

Validation won't have the entered info.
You might be able to do it by overriding new, but that's beyond me. Someone else would have to jump in here.