简体   繁体   English

CanCan ruby​​ on rails错误

[英]CanCan ruby on rails error

I'm just starting a new project in Rails and I wanted to add some CanCan roles checking to app. 我刚刚在Rails中开始一个新项目,我想在应用程序中添加一些CanCan角色。 What have I done: 1. Installed proper gem 2. Included in gemfile "cancan" 3. Created ability class 4. In my ApplicationController - added "check_authorization" 我做了什么:1。安装正确的gem 2.包含在gemfile中“cancan”3。创建的能力类4.在我的ApplicationController中 - 添加了“check_authorization”

But still, I get 但是,我知道了

undefined local variable or method `authorize_resource' for ApplicationController:Class 对于ApplicationController:Class,未定义的局部变量或方法`authorize_resource'

or 要么

undefined local variable or method `check_authorization' for ApplicationController:Class 对于ApplicationController:Class,未定义的局部变量或方法`check_authorization'

error. 错误。 Somebody got any ideas what can be the reason why? 有人有什么想法可能是什么原因?

My cancan version is 1.6.7. 我的康康版本是1.6.7。 Gem version is 1.9.1 宝石版是1.9.1

正如作者@Animattronic所说,重启你的Rails服务器。

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

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