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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:47:53+00:00 2026-06-07T19:47:53+00:00

I have Users, Roles, and Network models in Rails 3. Users and Networks have

  • 0

I have Users, Roles, and Network models in Rails 3. Users and Networks have a HMT relationship through Roles. If a User has an Role type of ‘admin’ with a specific Network, he/she can change the Role of other Users.

It seems like the Role type should not be available via mass-assignment. So how does a Network admin change the position type of other Users? I actually think this is a really basic question, but I just can’t find the answer.

I am using CanCan and have a current_user method. Does that simply mean the controller would have a simple if/then check to see if the user has the appropriate role in a network?

Does mass assignment only apply to pages that have no authentication?

  • 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-07T19:47:55+00:00Added an answer on June 7, 2026 at 7:47 pm

    So a couple things

    1. You’ll presumably display a role select box on the users/1/edit page if the user is an admin
    2. On the update action on the controller, you’ll have some kind of authorization to make sure the user is an admin
    3. When the time comes to make the update

    :

    class myModel < ActiveRecord::Base
      attr_accessible :some_attr, :other_attr
      attr_accessible :some_attr, :other_attr, :role_id, :as => :admin
    end
    
    class myController < ApplicationController
      #admin check before doing the following
      if @user.update_attributes(params[:user], :as => :admin)
        redirect_to root_path
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table joining two models in a has many through relationship. Users
I have the following domains: User, Role, Company. User and Role has m:n relationship,
I have the following models to associate users with roles: class User < ActiveRecord::Base
So I have two models: User and ScheduledSession The users have roles. One of
I am modifying my PHP network's code to have user roles like wordpress here
i have sql query select * from Roles Join Users On Roles.Role=Users.RoleId it return
I'm just learning ruby on rails and I have a table of user roles
I have a xml template like this <User> <UserId></UserId> <UserName></UserName> <Roles> <Role></Role> <Roles></Role> </Roles>
Basicall I have three Tables Users Roles and USerRoles with Many to many Relationship.
I am building a reservation system. I have users in roles('admin', 'client', 'employee', 'student').

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.