Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3486400
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:01:32+00:00 2026-05-18T11:01:32+00:00

In my application I want users to be able to create a group and

  • 0

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/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:01:33+00:00Added an answer on May 18, 2026 at 11:01 am

    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_token column to Group. 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:

    # in your Group model
    def redeem_token(some_code, invitee_name)
      invitation_token == decode_invitation_code(some_code, invitee_name)
    end
    
    def decode_invitation_code(encrypted, salt)
      # use EzCrypto or something similar : http://ezcrypto.rubyforge.org/
      # use the invitation_token as the password 
      # and the invitee name as the salt
      EzCrypto::Key.decrypt_with_password invitation_token, salt, encrypted
    end
    
    def generate_invitation_for(user)
      # use invitee name as salt 
      # and invitation_token as both password and content
      EzCrypto::Key.encrypt_with_password invitation_token, 
                                          user.name, 
                                          invitation_token
    end
    
    # in your routes.rb do something like
    resources :groups do
      member do
        get 'invitation/:invitation_token', :action => :invitation
      end
      # ...
    end
    
    # in your groups_controller.rb
    def invitation
      @group = Group.find(:id)
      if @group.redeem_token(params[:invitation_token], current_user.name)
        @group.add_member(current_user)
        redirect_to root_path, :alert => "You were added to the group!"
      else
        redirect_to root_path, :alert => Invitation code not valid!"        
      end
    end
    

    Hope you find this helpful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application in which users interact with each-other. I want to visualize
We have a high security application and we want to allow users to enter
I want to detect users' screen size and pass this into a charting application
I want my web application users to download some data as an Excel file.
I have built an application that uses SQL Express 2005 and I want to
I want to run a console application that will output a file. I user
I want to log user's actions in my Ruby on Rails application. So far,
I have a Java application which I want to shutdown 'nicely' when the user
I want to distribute a webstart application which uses RMI. I want to avoid
I have an Excel application in which I want to present the user with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.