0
기존 마운트 응용 프로그램에 일부 기능을 추가 할 수있는 마운트 가능 레일 (4.0.13) 엔진을 구축 중입니다.레일 엔진 내부에서`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
나는 undefined local variable or method 'spree_current_user'
을 얻고있다
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
가 있습니다!
내 엔진에서 사기꾼을 사용하려면 어떻게해야합니까? 어떤 도움이 많이이 응용 프로그램 컨트롤러에이 추가
include Spree::AuthenticationHelpers
시도 application_controller.rb에 추가 – Sajin
@Sajin는'추가 난사를 포함 :: AuthenticationHelpers'이 문제를 해결 포함 .. 많은 감사 –
답변으로 추가해야합니까? – Sajin