Rails 设备会话控制器
在设计中,许多教授如何完成某些事情的页面都需要编辑会话控制器。我使用这个 https://github.com/fortuity 设置设计/rails3-subdomain-devise/wiki/Tutorial-(演练) 它没有详细介绍如何创建会话控制器。我该如何制作一个。 (如果真的很容易,对不起,请给我几个简单的步骤)
In devise, many of the pages that teach how to accomplish certain things require editing a sessions controller. I set up devise using this https://github.com/fortuity/rails3-subdomain-devise/wiki/Tutorial-(Walkthrough) It didn't go over making a sessions controller. How do I make one. (If it's really easy i'm sorry, just give me the few simple steps)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用rails g controller MySessions 创建会话控制器。然后在控制器内部将其从从
ApplicationController
继承更改为 Devise Controller,如下所示:您想要覆盖的控制器内的任何逻辑都可以通过调用该方法并插入您自己的逻辑来覆盖。有关该控制器中的内容列表,您可以在其 Github 页面上查看代码。如果您不想重写它们的方法,您可以忽略它们,或者只调用 super.
Create your Sessions Controller with
rails g controller MySessions
. Then inside of your controller change it from inheriting fromApplicationController
to the Devise Controller like so:Any of the logic within that controller that you want to override you can override by calling that method and inserting your own logic. For the list of what's in that controller, you can view the code on their Github page. If you do not wish to override their methods you can either leave them out, or just call super.