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

  • Home
  • SEARCH
  • 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 6896921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:06:16+00:00 2026-05-27T07:06:16+00:00

Situation: I have a team model, a user model and a teamate model for

  • 0

Situation: I have a team model, a user model and a teamate model for the users of a team.

Say I want to have a view that contains the information of a team team/show
and that I wish (to simplify the user’s experience) to add a list of the users, an add user to team and the possibility to remove a user from that team.

To be perfectly restful, I would need a controller (let’s call it Teamates), it would handle the users of a team.
I would have all the CRUD needed.

Is it clean to have the team/show view call the teamates controller for the following actions: adduser, removeuser, listusers.

What I am trying to achieve is less clicks for the users.
In other words, I would like the user to be able to manage the users of a team from the team view instead if requireing him to navigate even further.

  • 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-27T07:06:17+00:00Added an answer on May 27, 2026 at 7:06 am

    I don’t think you need a controller for teamates.

    And you really should not have adduser/removeuser/etc actions in your team controller!

    You could set up your routes like that:

    resources :teams do
        scope :module => "team_scope" do
            resources :users
        end
    end
    

    Then you would have a UsersController in app/controllers/team_scope/users_controller.rb

    To create a new user for a team, you would post to: /team/1-team-a/users and it would hit the create action in the UsersController above.

    When you use scope in your routes, it does not change the route helpers like with namespace. The new action would just be accessible via new_team_user_path(@team).


    Hum… so yeah, in this case I would have a TeamatesController, and maybe set up my routes like that:

    resources :teams do
        resources :teamates, :only => [] do
            collection do
                get :edit
                put :update
            end
        end
    end
    

    And then you could edit the associations between a team and its players…

    Your form would post the users id to team_teamates_path(team)…

    But I’m really not sure it’s the best way, I’d have to think about it. This is not really restful as well.

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

Sidebar

Related Questions

Situation: I have a simple XML document that contains image information. I need to
Pseudo-situation: have a class (let's say BackgroundMagic ), and it has Start() and Stop()
I have following situation: I have loged user, standard authentication with DB table $authAdapter
I have the following situation: I have a certain function that runs a loop
I have situation, where running a query that filters by an indexed column in
I have a situation where I have created a new team project and imported
I have heard that the .NET 4 team has added new classes in the
I have 2 tables that I need to get information from, and would like
Got a situation where we have a working production website that is moving to
Given a situation where you have 2 projects that in total will provide enough

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.