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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:16:56+00:00 2026-05-24T03:16:56+00:00

I am working on a Rails App that uses Devise as the authentication module,

  • 0

I am working on a Rails App that uses Devise as the authentication module, however I want to customize it so that CanCan will only permit Administrators to create a new user. I am having a hard time understanding how to customize the controller for Devise so that this can be done. Any help would be appreciated.

  • 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-24T03:16:56+00:00Added an answer on May 24, 2026 at 3:16 am

    You can create a “User” controller that will manage users and then simply set permissions for it. So in your new User controller you can have something like:

    class UserController < ApplicationController
      load_and_authorize_resource
    
      def index
      end
    
      def new
      end
    
      def show
      end
    
      def create
        if @user.save
          flash[:notice] = "Successfully created User." 
          redirect_to root_path
        else
          render :action => 'new'
        end
      end
    
      def edit
      end
    
      def update
        params[:user].delete(:password) if params[:user][:password].blank?
        params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
        if @user.update_attributes(params[:user])
          flash[:notice] = "Successfully updated User."
          redirect_to user_index_path
        else
          render :action => 'edit'
        end
      end
    
      def destroy
        if @user.destroy
          flash[:notice] = "Successfully deleted User."
          redirect_to user_index_path
        end
      end
    
    end
    

    Assuming you have administrators set to:

    can :manage, :all
    

    You should be good to go.

    In your routes file you’ll need to set up your routes:

    resources :user, :controller => "user"
    

    Hope this helps!

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

Sidebar

Related Questions

I've been working on a rails app that uses the restful authentication plugin. It
I'm working on a Rails app that sends data through a form. I want
I'm working on a Rails app that will contain information on a bunch of
Scenario: I'm working on a rails app that will take data entry in the
I have a working rails 3.1 application that uses the mercury wysiwyg editor, however
I'm working on cleaning up an old Rails 2.3.5 app that uses Dragonfly to
I have a rails blog app that was working well.. However, I did some
I have a working rails app that uses imagemagick commands on my local mac
I'm working on a rails app that has a whole bunch of before filters
I'm working on a Rails app that existing users can invite additional members to

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.