Scope in Rails model vaidation

Hi all,

I have a requirement were the following is to be done:

A user can belong to single chapter. Chapter has many channels… So a
particular user can only be a part of a single chapter. How can i do
this validation in rails 3?

On 25 January 2012 06:49, angel david [email protected] wrote:

Hi all,

I have a requirement were the following is to be done:

A user can belong to single chapter. Chapter has many channels… So a
particular user can only be a part of a single chapter. How can i do
this validation in rails 3?

If a user belongs_to chapter then there is no need to validate that
the user is part of only one chapter as it is impossible to be part of
more than one with a belongs_to relationship. Have a look at the
Rails Guide on ActiveRecord Relationships for more information on
relationships.

Colin.