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 8166515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:53:42+00:00 2026-06-06T19:53:42+00:00

The Rails application I’m working on, has two central pieces: users and groups. A

  • 0

The Rails application I’m working on, has two central pieces: users and groups. A user registers through a form, and is added to the users table.

The groups table has four primary columns: name, title, description, and membership.

Groups are handled in two steps.

  1. Step1: the admin creates the group (name, title, description).
  2. Step2: Membership is a JSON field. Admin needs to log in using a second form, and add/edit that JSON structure’s fields: group owner, group admins, members, parse / re-parse into a JSON and update the groups table.

The user signup, and groups creation form are working fine. The problem is the second form: creating the group’s membership. I am not really sure how to proceed.

What I did is create the link and routes to properly select from the groups, and produce a REST call with the correct params by adding additional routes and links on the Show page. I verified that the l ink is correct, when I hover over it, I see http://myapp.com/groups/3/admin (3 is the correct ID in the groups table).

The methods in my groups_controller.rb are similar to the following:

  def show
    @group = Group.find(params[:id])
    respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @group }
  end
end

I created a groups_admin.html.erb and put it in the views/groups folder. It has in it the logic to construct a set of drop down boxes, allowing the admin to pick from the users list to fill the group membership (the functions are in the groups helper).

What I don’t know is how to complete it with a form declaration, etc. in groups_admin.html.erb and what to add to the groups_controller.rb to cause an UPDATE to that particular row (after I turn the returned fields into a JSON). So far, here’s what I have added to it

def admins
end

Changing the groups table schema and creating additional groups_admins, groups_owners, groups_members tables is not an option. Any ideas?

  • 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-06-06T19:53:44+00:00Added an answer on June 6, 2026 at 7:53 pm

    You’re looking for associations. In this case you probably want a group has_many users and a user has_many groups. Or if you want a user to be able to be in multiple groups you’re looking for a has_and_belongs_to_many association. You can read up on this here: http://guides.rubyonrails.org/association_basics.html

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

Sidebar

Related Questions

My rails application has two models, gallery and photo. Galleries have many photos and
I have two different Rails application speaking with each other through API calls. Gone
I have a Rails application, I have the following DB schema: each User has
I have a rails application where each user has a separate database. (taking Joel
My rails application has two sections. The main application and the admin interface. I
I've started a Rails application with Devise and CanCan. I have users which has
My Rails application has a number of tasks which are offloaded into background processes,
My Rails application makes use of Time.zone so that each user can set their
I'm working on rails application with postgres db.I have a table called merchant_review_votes where
My Rails application has a simple yaml file that's downloaded relatively frequently (5x per

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.