validate positive integer value in model - Ruby on Rails

validates_inclusion_of :some_attribute,

:within => 1..1.0/0,

:message => 'should be positive'

here 1.0/0 it means infinity...

So the attribute is validate within positive. It is done in rails with validates_inclusion_of for numeric data.


  • Company:
  • Programming Language:
  • Technology: