简体   繁体   English

注册Devise后如何设置页面模板以重定向到它?

[英]How to set up page template to redirect to it after Devise sign up?

After sign up I want to redirect to a custom page with something like: 注册后,我想使用以下内容重定向到自定义页面:

signed.html.erb signed.html.erb

"Thank you we have sent you an email..."

I followed the examples on the official documentation: How To: Redirect to a specific page on successful sign up (registration) 我遵循了官方文档中的示例: 如何:成功注册(注册)后重定向到特定页面

In all the documentation I have found this seems obvious but, 在所有文档中,我发现这似乎很明显,但是,

where do I place this template? 我在哪里放置此模板?

Do I have to create a custom route for this? 我是否需要为此创建自定义路线?

  1. Place the page wherever you want; 将页面放置在您想要的任何地方; wherever it makes the most sense in your application. 在您的应用程序中最有意义的地方。 (It could be a method and view associated with the new registrations controller you need to create, but it doesn't have to be) (它可以是与您需要创建的新注册控制器关联的方法和视图,但不一定必须如此)

  2. Yes, you'll need a route for it - just as you would with any other page. 是的,您将需要一个路由-就像处理其他任何页面一样。

In terms of the page you're redirecting to, there's nothing special about it, and it's not tied to Devise in any way at all. 就您要重定向到的页面而言,它没有什么特别之处,并且它根本不与Devise捆绑在一起。 It's just like any other page in your application (in fact, it could well be any other page in your application). 就像您应用程序中的任何其他页面一样(实际上,它很可能是您应用程序中的任何其他页面)。

So, make that page first. 因此,请首先创建该页面。 Put it where it makes the most sense, create a route for it, and make sure you can view it in your browser. 将其放在最有意义的位置,为其创建路由,并确保可以在浏览器中查看它。 Then, as a final step, just make Devise redirect to that route using the instructions you linked to above. 然后,作为最后一步,只需按照上面链接的说明将Devise重定向到该路由。

The instructions you linked to are purely for 'redirecting to another url after signup', and not for 'creating the page that you redirect to'. 您链接到的说明纯粹是为了“注册后重定向到另一个URL”,而不是“创建重定向到的页面”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM