monicao
5/25/2011 - 7:14 PM

Devise login redirect for authentication systems with multiple roles

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