Devise 设计/轨道:注册后路径(资源)

Devise 设计/轨道:注册后路径(资源),devise,ruby-on-rails-3.2,Devise,Ruby On Rails 3.2,我正在rails应用程序中使用Desive进行用户注册/登录。在注册时,我想将用户重定向到其配置文件页面 我做了rake路由,对于编辑,root是: /profiles/:id/edit 我在注册控制器中写下了这句话: def after_sign_up_path_for(resource) 'http://localhost:3000/profiles/#{resource.id}/edit' end 但它不起作用。有人能帮忙吗?您不应该使用: def after_sign_up_path

我正在rails应用程序中使用Desive进行用户注册/登录。在注册时,我想将用户重定向到其配置文件页面

我做了rake路由,对于编辑,root是:

/profiles/:id/edit
我在注册控制器中写下了这句话:

def after_sign_up_path_for(resource)
'http://localhost:3000/profiles/#{resource.id}/edit'
end
但它不起作用。有人能帮忙吗?

您不应该使用:

def after_sign_up_path_for(resource)
  edit_profile_path(resource)
end
而不是硬编码
http://localhost:3000/profiles/#{resource.id}/edit

将您的路由文件也发布会很有帮助。

您不应该使用:

def after_sign_up_path_for(resource)
  edit_profile_path(resource)
end
而不是硬编码
http://localhost:3000/profiles/#{resource.id}/edit

如果能把你的路线文件也张贴出来,那会很有帮助的