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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:59:37+00:00 2026-05-23T03:59:37+00:00

I have two types of users: user and editor. I have a User model

  • 0

I have two types of users: user and editor. I have a User model with the boolean column is_editor to determine if a user is an editor.

Let’s assume. User Foobar decides to sign up as an editor. He succeeds. From today onwards, he is an editor. One day Foobar accidentally navigates to the editor registration page (registrations controller, new action).

Since Foobar is already an Editor, I should redirect him to his profile page. Should I use an authorization gem (such as Cancan) for this? Or should I have a simple method (i.e. before_filter :check_if_user_is_not_an_editor) in the registrations controller that checks if user is already an editor and redirect?

If I end up using the Cancan approach. The thing is, I already have the following that checks for other authorization.

  rescue_from CanCan::AccessDenied do |exception|
    flash[:alert] = exception.message
    redirect_to root_url
  end

Which will render a flash alert message: You are not authorized and redirect to root url. Which is not what I want, because I need to redirect to Foobar’s profile instead.

What are your thoughts? Is this the task of authorization or just a simple redirect in the said controller? Which is the more appropriate approach?

  • 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-23T03:59:37+00:00Added an answer on May 23, 2026 at 3:59 am

    Honestly, it seems pretty minor so whatever you choose, I wouldn’t feel bad about your approach. Personally, I would go with your second option (simple redirect). First of all, it seems simpler, which is always a plus. If you’re using an authentication solution like Devise, you probably have a current_user or user_signed_in? helper that you can use in a before filter quite easily. Secondly, it doesn’t really strike me as the type of problem that authorization is concerned with.

    In one sense, it is a permissions concern (I guess semantically anyways) since your application defines behavior that is ‘not allowed’. Realistically, it’s not allowed but not because the user doesn’t have necessary permission. The reason the behavior isn’t allowed is because no user should be able to register as the same type of user they’re already registered as – that is, there are no user types that should be able to do such a thing so the currently-logged in user’s permissions are moot. It seems like your problem should be resolved by defining application behavior – not user permissions.

    Just the way I see things, feel free to implement whatever solution you feel fits best.

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

Sidebar

Related Questions

I have two types of users on my site: Normal user Supplier How do
My site has two types of users; customers and suppliers. I have ended up
I'm building an application that will have two different types of users, lets call
I have a Reports controller and two types of users: companies and customers. Each
I have a cocoa app with two types windows each of which requires a
I have two implementations of a method, one for value types and another for
A common (i assume?) type of query: I have two tables ('products', 'productsales'). Each
I have two views: create and edit. Both share a strongly typed editor template
I have the following module, which affects how users arrive at two different content
I have two types of roles [Admin, HelpDeskAdmin]. I have a single logon view(both

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.