I've got users who are members of groups through a membership join table, and one of the attributes of that join table is "administrator". I'm trying to do a check inside of a group's member view, looping through each member to see if they are an administrator.

In the view I tried the following:

```
for user in @group.users
  if user.administrator?
    ...DO STUFF
  end
end

```

I also tried this in the controller:

```
@administrators = @group.memberships.find(:all, :conditions => ["administrator = 1"])

```

But no luck. Any thoughts?

**UPDATE - per below, put a method into the user model:**

```
def is_administrator_of(group_id)
        Membership.find(:first, :conditions => ['user_id = ? AND group_id = ? AND administrator = ?', self[:id], group_id, true])
end

```