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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:13:39+00:00 2026-05-24T18:13:39+00:00

One common case being the app has users and groups, only a user who

  • 0

One common case being the app has users and groups, only a user who is an admin of the group can add/remove users. I might have a controller action that goes “@group.add_member if current_user.is_admin”

It seems testing this behavior should be part of the model unit tests., because it’s a single piece of code responsible for a single task. But I’m not sure how best to include the fact that this method’s correctness depends on the controller. I was thinking:

  1. One option is to redefine the model method to take an additional param for current_user, but
    that seems a bit ugly.
  2. Another option is to test just “add_user” in the model and check ‘is_admin’ behavior in the
    controller test instead, though I was thinking this is a model concern.
  3. Yet another option is to have this method be part of the User model
    instead of Group, so to be invoked as: “current_user.add_member_to_group” <– sounds like the
    responsibility for that functionality should be in the Group model
    though.

Thoughts?

  • 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-24T18:13:40+00:00Added an answer on May 24, 2026 at 6:13 pm

    Option 2 is fine.

    Logic is safe:

    • the model is responsible for it’s business

    • the controller is the conductor

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

Sidebar

Related Questions

I am moving a system from a VB/Access app to SQL server. One common
I have a database where one of the common queries is has a where
Ever since switching from TABLE-layout to DIV-layout, one common problem remains: PROBLEM : you
Does anyone know of papers/books/etc. that document patterns for databases? For example, one common
I've got two web sites (written in c#) which are pretty common: One is
So one of the common tasks that I do as a programmer is debugging
I have some tables. These tables all have one column in common called 'classified_id':
One of the most common dilemmas I have when commenting code is how to
This is probably one of the most common tasks / problems when programming; You
Fragile base class is one of the most common point that gets popped up

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.