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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:38:55+00:00 2026-05-31T21:38:55+00:00

I am using rails3 and gem devise and i have two roles admin and

  • 0

I am using rails3 and gem devise and i have two roles admin and customer and i want after user

sign out admin should redirect to different path and customer should redirect to different path

when sign out..

  • 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-31T21:38:56+00:00Added an answer on May 31, 2026 at 9:38 pm

    You can get your desired functionality by using devise method after sign_out path.

    but before you define these methods in application helper.

    def is_admin?(user)
      admin_role = Role.find(:first, :conditions => ["name = ?", "admin"])
      return user.roles.include?(admin_role)
    end
    
    
    def is_customer?(user)
      admin_role = Role.find(:first, :conditions => ["name = ?", "customer"])
      return user.roles.include?(admin_role)
    end
    

    After that include application helper in application controller and define this method

    def after_sign_out_path_for(resource_or_scope)
      if is_admin?(current_user)
        home_path = "/admin/users/sign_in"
      elsif is_customer?(current_user)
        home_path = "/customer"
      end
        respond_to?(home_path, true) ? send(root_path) : home_path
    

    end

    Hope it will work fine !!!

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

Sidebar

Related Questions

I'm using 'rails3-jquery-autocomplete' gem, but it doesn't have multi column search, but there is
I have a rails app that is using Devise, with a User model, no
I'm using Rails with the Devise gem . If I try to sign-in with
We've got a Rails application just upgraded to Rails3 using Devise's Rails3 gem for
I'm using devise gem for login functionality in my Rails3 application.The gem as provides
I have installed a gem on my Rails application (devise). After I installed the
I've employed devise as the user-authentication gem for my rails web-app. Using this pre-generated
I am using rails 3 with gem devise.Devise has built in method for change
Is it possible to select DISTINCT values using Rails3 JQuery autocomplete gem?
Using the less-rails gem. Using the following code to mix two colours: @base: #ffdc52;

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.