Bugan Saiya Wed Nov 23 06:51:01 -0500 2011

Subject: Validation For Column Field Type Int


I'm newbie in php activerecord. I was playing with validation in this library and found that if I have a int column field such as status, it can't be validated with $validates_presence_of because when I assigned status like in the code below

$model->status = $_POST['status'] // $_POST['status'] is "" (I got the value from select dropdown)

I always got $model->status return 0 (so that's why $validates_presence_of doesn't work)

So, what is the correct way to validate int field column?

Thank you :)