Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/54.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails CanCan ruby on rails错误_Ruby On Rails_Authentication_Authorization_Cancan - Fatal编程技术网

Ruby on rails CanCan ruby on rails错误

Ruby on rails CanCan ruby on rails错误,ruby-on-rails,authentication,authorization,cancan,Ruby On Rails,Authentication,Authorization,Cancan,我刚刚在Rails中开始一个新项目,我想在应用程序中添加一些CanCan角色检查。我做了什么: 1.安装正确的宝石 2.包含在GEM文件“cancan”中 3.创建能力类 4.在my ApplicationController中-添加了“检查授权” 但是,我还是得到了 ApplicationController:类的未定义局部变量或方法“authorize\u resource” 或 ApplicationController:Class的未定义局部变量或方法“check\u authoriza

我刚刚在Rails中开始一个新项目,我想在应用程序中添加一些CanCan角色检查。我做了什么: 1.安装正确的宝石 2.包含在GEM文件“cancan”中 3.创建能力类 4.在my ApplicationController中-添加了“检查授权”

但是,我还是得到了

ApplicationController:类的未定义局部变量或方法“authorize\u resource”

ApplicationController:Class的未定义局部变量或方法“check\u authorization”

错误。 有人知道原因是什么吗

我的cancan版本是1.6.7。
Gem版本是1.9.1

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

天哪,我是个白痴。我在没有重新启动服务器的情况下完成了所有这些(包括安装gem)。对不起,吵闹了。孩子们,记住-总是在GEM安装后重新启动服务器!谢谢你…我总是犯这样愚蠢的错误