我是Ruby on Rails的新手,我試圖爲此找到一個解決方案。 我有開始這樣的控制器:ActionController :: RoutingError(未定義的方法`load_and_authorize_resource'UserAccountsController:Class):
class UserAccountsController < ApplicationController
include Concerns::UserFinancialContext
load_and_authorize_resource :except => [:change_contract, :show_modal_simulator_invoice, :project_member_info, :new_account_in_modal, :user_view]
我也有在這裏的.rb文件:
app/controllers/concerns/user_financial_context.rb
最後
app/doc/Concerns/UserFinancialContext.html
但下面的錯誤出現:
ActionController::RoutingError (undefined method `load_and_authorize_resource' for UserAccountsController:Class):
app/controllers/user_accounts_controller.rb:3:in `<class:UserAccountsController>'
app/controllers/user_accounts_controller.rb:1:in `<top (required)>'
任何想法如何解決?
'load_and_authorize_resource'來自CanCan gem。你是否正確設置了它? –