filterrific
filterrific copied to clipboard
Autoconverting to Fixnum strips out leading zero
Hi,
I have a phone_number field on my model where phone numbers can begin with a 0 (eg. 01987654)
I wish to filter records based on this field but the leading zero is removed because filterrific automatically converts the input to Fixnum and thus removes the leading zero.
Is there any way to prevent this autoconversion?
PS. Great library - thanks so much!
@gearoidoceallaigh thanks for using Filterrific. Currently there is no simple way to prevent the autoconversion. I'd suggest you prefix it with something like '_' (underscore). That will prevent the casting to Int. Then you'd remove the leading underscore before you actually use the param in the scope.
I'm reviewing currently if we can get rid of the Int parsing alltogether.