Create groups with rails and invite them

I have a basic application for rails and use inventing for self-realization. while I have a User model. Now, I would like to have the function of groups in my application, where the user can create and invite others to join groups.

SO how do I create groups, and also, since I have already developed customization, how can I use to develop an attractive plugin for inviting and adding group members as members?

thanks

+4
source share
1 answer

From what I've seen, most of the โ€œgroupโ€ functions in Rails are built on the idea that there is a many-to-many relationship between users and groups. Groups hold many users as members, and users have membership in many groups. Thus, it is fairly simple to implement groups using has_many: through the relationships provided by ActiveRecord. Here is the simplest implementation:

class Group has_many :users, :through => :memberships end class User has_many :groups, :through => :memberships end class Membership belongs_to :group belongs_to :user end 

Take a moment to look at the Rails tutorial, which discusses ActiveRecord associations, and you get an image.

I am sure that the Devise Invitable plug-in is used to invite someone to create a registration on your site, rather than inviting them to join a group on your site. I donโ€™t know any gemstones that manage the group invitation system.

If groups are the main aspect of what you do with your site, you can look at some of the CMS options built on RoR. I think some of them have group management capabilities. Here is the resource: https://www.ruby-toolbox.com/categories/content_management_systems

Hope this helps.

+3
source

Source: https://habr.com/ru/post/1397954/


All Articles