Railsで「整数のみ」、「0以上の正の数のみ」のvalidatesの書き方


環境

Rails 5.1.7
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

結論

 validates :price, presence: true, numericality: {only_integer: true, greater_than_or_equal_to: 0}

解説

「整数のみ」の箇所
only_integer: true,

「0以上の正の数のみ」の箇所
greater_than_or_equal_to: 0