Help with Joins (Users and Roles)

What I am trying to do is setup a set of joins that do the following

User has a global role such as :global_admin, :building_admin, etc

I also have Organizations, Districts, and Buildings

I would like a user to be able to be assigned a different role per
Organization, District, or Building

I have a User with a global_role and that works fine.

I can't figure out how to define the user to be part of say an
Organization with different role.

Can anyone can show me an example or point me in the right direction to
figure this out?

John

put a table / model like orginiation_user_roles / OrganizationUserRole with columns like organization_id, user_id , and roll . Make the roll as enum type http://edgeapi.rubyonrails.org/classes/ActiveRecord/Enum.html . I hope my answer helps.