내 의견의 범위를 좁힐 수있는 방법이 궁금합니다. 나는 조직에 따라 커스텀 테마를 갖고 싶다. 쇼/인덱스 액션에서 직접 렌더링을 사용할 수는 있지만 작동한다.하지만 애플리케이션에서 많은 액션을 오버라이드해야한다. 내가 컨트롤러 수준에서 그것을 할 선호하고 prepend_view_path
함께 일을했지만 그것은 정의되지 않은 변수를 제외하지 않았다.멀티 임차 앱의 레일 오버라이드/범위 지정보기
class EditionsController < ApplicationController
helper_method :current_organization
prepend_view_path "app/views/#{current_organization.slug}/editions" #doesn't work
def show
@edition = Edition.find(params[:edition_id])
@page = @edition.pages.first
render template: "#{current_organization.slug}/editions/show" #works
end
아이디어가 있으십니까?
는 또한 시도 : (동일한 오류와)
append_view_path(File.join(Rails.root, "app/views/#{current_organization.slug}"))
거의 내가 Organization.first.slug를 넣어 경우 undefined''로 current_organization 도우미 방법 오류 아웃, 대신 잘 작동한다는 점을 제외하고. 그러나 prepend가 current_organization 도우미 이전에로드되고있는 것처럼 보입니다. – ere