# validations

**URL:** <https://discuss.rubyonrails.org/t/validations/2785>\
**Category:** rubyonrails-talk\
**Created:** [October 8, 2006, 3:56pm UTC](https://discuss.rubyonrails.org/t/validations/2785 "2006-10-08T15:56:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diego\_Lapiduz](https://avatars.discourse-cdn.com/v4/letter/d/3e96dc/32.png) [@Diego\_Lapiduz](https://discuss.rubyonrails.org/u/Diego_Lapiduz)\
**Post date:** [October 8, 2006, 3:56pm UTC](https://discuss.rubyonrails.org/t/validations/2785/1 "2006-10-08T15:56:26Z")

</div>

> 2. If i check this validates\_numericality\_of :price why do i have to check in here: def validate &nbsp;&nbsp;errors.add(:price, "should be at least 0.01" ) if price.nil? || price \< 0.01 end
> 
> if price.nil? ? Why do i have to check that ? Isnt that checked with validates\_numericality\_of :price ?

Hi,

You can use validates\_numericality\_of :price, :allow\_nil=\>false
