Fabien Maître Thu Aug 09 20:08:28 -0400 2012

Subject: validates_inclusion_of a property in a variable's array

Hi,
I want to validate that the value of my property "no" is 0 or 1.
This code works fine :
static $validates_inclusion_of = array(
array('no', 'in' => array(0, 1), 'message' => 'no must be 0 or 1')
);

But this one doesn't work :
public $possible_values = array(0, 1);
static $validates_inclusion_of = array(
array('no', 'in' => $possible_values, 'message' => 'no must be 0 or 1')
);

Do you know why? Is this not possible?

Thank you.