Skip to content

Instantly share code, notes, and snippets.

@monicao
Created May 25, 2011 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monicao/991669 to your computer and use it in GitHub Desktop.
Save monicao/991669 to your computer and use it in GitHub Desktop.
Devise login redirect for authentication systems with multiple roles
def after_sign_in_path_for(resource)
if current_user.admin?
stored_location_for(:user) || admin_projects_url
elsif current_user.artist?
stored_location_for(:user) || artists_dashboard_url
elsif current_user.client?
stored_location_for(:user) || dashboard_url
else
stored_location_for(:user) || root_url
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment