Ruby on rails 通过omniauth重定向到根url进行设计,我无法更改它

Ruby on rails 通过omniauth重定向到根url进行设计,我无法更改它,ruby-on-rails,devise,omniauth,Ruby On Rails,Devise,Omniauth,当我登录或注册facebook时,我被重定向到我的根url。 在我的omniauthcallbacks控制器中,我认为这就是它发生的地方: def facebook @user = Artist.from_omniauth(request.env["omniauth.auth"]) if @user.persisted? sign_in_and_redirect :artist, @user, :event => :authentication #this will th

当我登录或注册facebook时,我被重定向到我的根url。 在我的omniauthcallbacks控制器中,我认为这就是它发生的地方:

def facebook
  @user = Artist.from_omniauth(request.env["omniauth.auth"])

  if @user.persisted?
    sign_in_and_redirect :artist, @user, :event => :authentication #this will throw if @user is not activated
    set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format?
  else
    session["devise.facebook_data"] = request.env["omniauth.auth"]
    redirect_to new_user_registration_url
  end
end
如何将其重定向到另一个路由?

请参阅

在应用程序控制器中,您可以定义以下方法:

在注册路径之后 在路径中签名后 在\u注销\u路径\u之后 并将用户发送到您想要的任何位置。在我的应用程序中,我有Users和AdminUsers,我的方法是这样的:

  def after_sign_in_path_for(resource)
    case resource
    when AdminUser
      admin_root_path
    else
      session.delete(:after_sign_iou_url) || root_path
    end
  end
会话变量在别处设置