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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:56:47+00:00 2026-06-16T12:56:47+00:00

I have two separated login model in my rails app: User Admin My rake

  • 0

I have two separated login model in my rails app:

  • User
  • Admin

My rake routes output is:
rake routes | grep devise

 new_admin_session GET    /admins/sign_in(.:format)                                                 devise/sessions#new
                  admin_session POST   /admins/sign_in(.:format)                                                 devise/sessions#create
          destroy_admin_session DELETE /admins/sign_out(.:format)                                                devise/sessions#destroy
               new_user_session GET    /users/sign_in(.:format)                                                  devise/sessions#new
                   user_session POST   /users/sign_in(.:format)                                                  devise/sessions#create
           destroy_user_session DELETE /users/sign_out(.:format)                                                 devise/sessions#destroy
                  user_password POST   /users/password(.:format)                                                 devise/passwords#create
              new_user_password GET    /users/password/new(.:format)                                             devise/passwords#new
             edit_user_password GET    /users/password/edit(.:format)                                            devise/passwords#edit
                                PUT    /users/password(.:format)                                                 devise/passwords#update
       cancel_user_registration GET    /users/cancel(.:format)                                                   devise/registrations#cancel
              user_registration POST   /users(.:format)                                                          devise/registrations#create
          new_user_registration GET    /users/sign_up(.:format)                                                  devise/registrations#new
         edit_user_registration GET    /users/edit(.:format)                                                     devise/registrations#edit
                                PUT    /users(.:format)                                                          devise/registrations#update
                                DELETE /users(.:format)                                                          devise/registrations#destroy

and in ApplicationController i have

 def after_sign_in_path_for(resource)
    request.referrer 
  end

It works great for my user model, but how to do it for my admin model, so that after sign in i’m redirected to same page (i use built-in devise controllers) like after_admin_sign_in_path_for(resource)
becouse if i write so i have in log:

Filter chain halted as :require_no_authentication rendered or redirected
  • 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-16T12:56:48+00:00Added an answer on June 16, 2026 at 12:56 pm
    def after_sign_in_path_for(resource)
      case resource
      when User then request.referrer 
      when Admin then ....
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Invoice model in a Rails app. The Invoice has_many Products and
I have a User model with the usual information (login, email, name, location, etc).
I have a CakePHP 2.0 app that uses the AuthComponent with User model to
I have model User class User < ActiveRecord::Base has_and_belongs_to_many :roles attr_accessible :login, :email, :password,
I have two separated applications, one written in Java and other in Erlang. Both
Why in struts 1.3 we have two separated classes for handling request : --
I have two comma-separated selectors; .class, .foo, .bar .lorem, .ipsum, .potato I'd like to
I have two text files with various columns, each column is separated by a
I have two anchored images on top of each other, separated with a line
I am trying to get at least three words separated by two commas.I have

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.