Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 25th, 2012  |  syntax: None  |  size: 0.42 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. With Devise, how do I force the redirect location after sign in?
  2. sign_in_and_redirect @user, :event => :authentication
  3.        
  4. sign_in_and_redirect(@user, :event => :authentication, :redirect_to => '/settings')
  5.        
  6. class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
  7.  
  8. private
  9.  
  10.   def after_sign_in_path_for(resource)
  11.     if resource.is_a?(User)
  12.        WHEREVER YOU WANT TO REDIRECT THEM
  13.     end
  14.   end
  15. end