Help with Joins (Users and Roles)

15 views
Skip to first unread message

John Sanderbeck

unread,
May 29, 2016, 11:47:13 AM5/29/16
to rubyonra...@googlegroups.com
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

--
Posted via http://www.ruby-forum.com/.

Karthikeyan A K

unread,
May 29, 2016, 1:18:34 PM5/29/16
to rubyonra...@googlegroups.com
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.


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/703029e437465274d6a23b07331b933f%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages