dimanche 7 mai 2017

Validate only numbers

In one of my rails models I have this :only_integer validation:

validates :number, presence: true, numericality: { only_integer: true }

This validation also allows inputs like +82938434 with +-signs.

Which validation should I use to only allow inputs without + - only numbers?

Aucun commentaire:

Enregistrer un commentaire