无法让 cancan 在 Rails 3.1 上工作
我使用 Rails 休息了两个月,现在当我回来时,它让我痛苦不已!
我正在尝试让 CanCan 在 Rails 3.1 上工作,并查看了 Railscast,然后按照他们在 cancan git 页面上的说明进行操作。但是,当我尝试运行主页时,出现以下错误:
Routing Error
undefined local variable or method `authorize_resource' for StaticController:Class
如何停止此操作?就好像 cancan 没有加载一样,但我已经使用捆绑器安装了它,并且它没有提到我必须做任何其他事情来包含它。
有人有什么想法吗?
I had a two month break using Rails and now its biting me when I return!
I am trying to get CanCan to work on Rails 3.1 and have viewed the railscast and then followed their instructions on the cancan git page. However when I try run the homepage it gives me the following error:
Routing Error
undefined local variable or method `authorize_resource' for StaticController:Class
How do I make this stop? Its as if cancan is not loaded, but I have installed it using bundler and it doesnt mention that I have to do anything else to include it.
Anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对不起我的不好!太多的咖啡导致我没有阅读所有有关如何安装它的说明。
我需要将以下内容添加到我的 ApplicationController:
然后我需要使用
因为在这个特定的示例中它只是一个静态的简单主页,位于一个更复杂的 Web 应用程序前面。
感谢您的帮助。
Sorry my bad! Too much coffee resulted in me not reading all the instructions for how to install it.
I needed to add the following to my ApplicationController:
and then I needed to use
Because in this particular example it was just a static simple homepage that sits infront of a more complicated web app.
Thanks for the help.