开发者

Rails Validations, only integers for :price_in_cents

validates_开发者_如何学运维format_of :price_in_cents, :with =>

What is the regexp for this simple validation


You can use validates_numericality_of with only_integer, combined with positive numbers to represent price in pennies.


/[0-9]+/ Matches one or more integers, however there are better ways to do this (as seen in marklai's answer).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜