On 25 January 2012 06:49, angel david
<lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>
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.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.