That is exactly what I was looking for.

Thanks so much Colin.

On Aug 7, 5:17 pm, Colin Law <[email protected]> wrote:
> 2009/8/7 CoolAJ86 <[email protected]>:
>
>
>
>
>
>
>
> > Ideally what I would like to have happen:
> > Contact.find (and .find_by_xyz, etc) will never return a contact
> > unless contact.group is IN
> > current_user.contact.group.supergroup.groups
>
> > Scenario:
> > User belongs to a Contact.
> > Contact belongs to a Group.
> > Group belongs to a SuperGroup.
>
> > Contact has permissions to access the directory listing of other users
> > of the same SuperGroup, but no one else.
>
> > There is never a case where Contact.find (or its derivatives
> > - .find_by_xyz) is called unless a User, which has_one Contact is
> > logged in.
>
> > What I want assistance with:
> > How can I put this constraint into the model?
> > There will never be an exception to this rule so I don't want to use a
> > named scope unless that's the only way. I want to override every
> > default find for this class, but I don't know how.
>
> How aboutdefault_scope?
>
> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to