0
我正在構建一個可掛載的rails(4.0.13)引擎,以將一些功能添加到現有的spree應用程序中。無法在rails引擎內調用`spree_current_user`
我app/engines/my_engine/app/controllers/my_engine/application_controller.rb
module MyEngine
class ApplicationController < ActionController::Base
include Spree::Core::Engine.routes.url_helpers
include Spree::Core::Engine.helpers
include Spree::Core::ControllerHelpers
end
end
裏面的發動機控制器之一 - app/engines/my_engine/app/controllers/my_engine/some_controller.rb
我有
require_dependency "my_engine/application_controller"
module MyEngine
class SomeController < ApplicationController
before_action :find_user, except: :destroy
.
.
private
def find_user
@user = spree_current_user
end
end
end
我得到undefined local variable or method 'spree_current_user'
!
我應該怎麼做才能在我的引擎中使用spree助手?任何幫助非常讚賞
嘗試添加這對您的應用程序控制器'包括施普雷:: AuthenticationHelpers' – Sajin
@Sajin加入'包括施普雷:: AuthenticationHelpers'固定的問題..非常感謝 –
我應該添加它作爲答案? – Sajin