Excuse me for this, but I can't find my error. Here is my registrations_controller.rb code:
对不起,但我找不到我的错误。这是我的registrations_controller.rb代码:
class RegistrationsController < Devise::RegistrationsController
protected
def after_sign_up_path_for(resource)
edit_user_registration_path(current_user)
end
end
in my routes:
在我的路线:
devise_for :users, :controllers => { :registrations => "registrations" }
And redirection isn't working...
重定向不起作用......
2 个解决方案
#1
1
Have you tried:
你有没有尝试过:
class RegistrationsController < Devise::RegistrationsController
protected
def after_sign_up_path_for(resource)
'/an/example/path'
end
end
...then adding this to your routes:
...然后将其添加到您的路线:
devise_for :users, :controllers => { :registrations => "registrations" }
All that is from this, which took about 30 minutes of searching the googles to run across that. Was the only thing that worked for me.
所有这一切都来自于此,花了大约30分钟的时间搜索谷歌。唯一对我有用的东西。
Edit: I might also add that after poking through the code, it doesn't look like this results in an actual redirect (despite what some docs say); I'm getting a 200 back.
编辑:我可能还会在浏览代码之后添加它,看起来这不会导致实际重定向(尽管有些文档说的话);我得到200回。
#2
0
Your path should be valid (try to check rake routes | grep registration
) otherwise you will be redirected to root_path
or "/"
您的路径应该有效(尝试检查rake路由| grep registration)否则您将被重定向到root_path或“/”
def signed_in_root_path(resource_or_scope)
scope = Devise::Mapping.find_scope!(resource_or_scope)
home_path = "#{scope}_root_path"
if respond_to?(home_path, true)
send(home_path)
elsif respond_to?(:root_path)
root_path
else
"/"
end
end
来自Devise源代码
#1
1
Have you tried:
你有没有尝试过:
class RegistrationsController < Devise::RegistrationsController
protected
def after_sign_up_path_for(resource)
'/an/example/path'
end
end
...then adding this to your routes:
...然后将其添加到您的路线:
devise_for :users, :controllers => { :registrations => "registrations" }
All that is from this, which took about 30 minutes of searching the googles to run across that. Was the only thing that worked for me.
所有这一切都来自于此,花了大约30分钟的时间搜索谷歌。唯一对我有用的东西。
Edit: I might also add that after poking through the code, it doesn't look like this results in an actual redirect (despite what some docs say); I'm getting a 200 back.
编辑:我可能还会在浏览代码之后添加它,看起来这不会导致实际重定向(尽管有些文档说的话);我得到200回。
#2
0
Your path should be valid (try to check rake routes | grep registration
) otherwise you will be redirected to root_path
or "/"
您的路径应该有效(尝试检查rake路由| grep registration)否则您将被重定向到root_path或“/”
def signed_in_root_path(resource_or_scope)
scope = Devise::Mapping.find_scope!(resource_or_scope)
home_path = "#{scope}_root_path"
if respond_to?(home_path, true)
send(home_path)
elsif respond_to?(:root_path)
root_path
else
"/"
end
end
来自Devise源代码