Niranjan Acharya Sun Dec 11 05:03:13 -0500 2011

Subject: Help with Validations

Hi

I want to use validations in my model and was checking the validations_uniqueness_of

I believe this validations run on columns that are configured in the parameter. This works for the whole table.

scenario

Table Users (
id
firstname
lastname
)

Table Shoes(
id
user_id
size
shoemodel_id
)

Table shoemodels(
id
name
make
)

So I have the Models here

Class User extends ActiveRecord\Model {
static $has_many = array(array('shoes'));
}

class Shoe extends ActiveRecord\Model {
static $belongs_to = array(array('user'), array('shoemodel'));
}

class shoemodel extends ActiveRecord\Model {
static $has_many = array(array('shoes'));
}

What I want is each user can have many shoes but one shoe model of each shoe.

please guide me how can I use the validations in this regards