Rails 3 RESTful身份验证 - 未初始化的常量ApplicationController :: AuthenticatedSystem

Ric*_*kes 9 restful-authentication ruby-on-rails-3

刚刚从https://github.com/Satish/restful-authentication安装了Rails 3的升级版restful_authentication插件.我试图在我的应用程序助手中包含插件中的代码,如下所示:

class ApplicationController < ActionController::Base
    protect_from_forgery

    include AuthenticatedSystem
end
Run Code Online (Sandbox Code Playgroud)

但是,当我运行服务器并导航到localhost上的应用程序时,我收到如下错误:

uninitialized constant ApplicationHelper::AuthenticatedSystem
Run Code Online (Sandbox Code Playgroud)

AuthenticatedSystem是lib/authenticated_system.rb中的一个模块,那么为什么包含工作呢?

Ant*_*tre 20

Rails 3不再默认加载/ lib目录中的文件:(

将其添加到您的config/application.rb:

config.autoload_paths << "#{Rails.root}/lib"
Run Code Online (Sandbox Code Playgroud)

而你应该没事.不要忘记重新启动服务器.