应用控制器功能
我有一个具有访客用户功能的应用程序。我试图了解如何调用我的应用程序控制器 guest_user 方法。我以为我需要在应用程序控制器中使用 before_filter 才能调用它们,但是当我注释掉 before_filter 时,这些方法仍在被调用。应用程序控制器会自动调用这些吗?这似乎是一个简单的问题,但我在任何地方都找不到它的详细说明。我使用本指南创建 guest_user 功能 https:// /github.com/plataformatec/devise/wiki/How-To:-Create-a-guest-user 我正在使用 Rails 3.1.1、formtastic 2.0.2 和 devise 1.5.1.谢谢!
I have an app with guest user functionality in it. I'm trying to understand how my applicationcontroller guest_user methods are being called. I thought I would need a before_filter in the applicationcontroller in order for them to be called but when I comment out before_filter, the methods are still being called. Does applicationcontroller automatically call these? This seems like a simple question but I couldn't really find it spelled out anywhere. I used this guide to create my guest_user functionality https://github.com/plataformatec/devise/wiki/How-To:-Create-a-guest-user I'm using rails 3.1.1, formtastic 2.0.2, and devise 1.5.1. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题解决了,我通过一个控制器中的另一种方法调用 current_or_guest_user 方法。这是我第一次使用 ApplicationController,所以我很快就认为这是有责任的,下次在提出问题之前我会更加小心。谢谢。
Problem solved, I was calling the current_or_guest_user method through another method in one of my controllers. It was my first time working with the ApplicationController so I was quick to assume that was responsible, I'll be more careful next time before I make a question. Thanks.