In my application I want users to be able to create a group and invite other users to that group for collaboration. The important thing is that these groups are separated so their posts are not mixed. I have looked for awhile and I am not really sure how to get started on this problem. Any help will be appreciated!
TIA
I found this link but not sure how to apply it.
http://www.icoretech.org/2010/03/rails-users-groups-memberships-enter-workflow/
That link has a very sophisticated implementation of user groups and memberships. It even shows how to use the awesome Workflow gem to implement a state machine to track the process of joining a group. Honestly, I doubt you’ll get a much better answer. I suggest you just take the code in the blog post as a starting point and make modifications to suit your needs.
The only thing missing is invitations. I would keep it simple and just add an
invitation_tokencolumn toGroup. When an invitation is sent, the token is used to generate a SHA-1 hash which can be part of the link sent to the invited user. When the link is clicked, the controller can check if the invitation code is valid and add the user to the group.Here’s a little sample code to give an idea of the implementation. I’m sure there is plenty of room for improvement, but hope it gives you some direction:
Hope you find this helpful.