저는 다중 스키마가있는 PostgreSQL을 사용하는 애플리케이션을 개발하여 애플리케이션의 멀티 테넌트 측을 구현했습니다. 세입자는 하위 도메인을 통해 확인되지만, 여전히 주 도메인을 등록 포인트로 사용하고 관리 백엔드를 사용할 수있는 방법을 찾고 있습니다.하위 도메인 및 하위 도메인을 사용하지 않는 멀티 테넌트 루비 애플리케이션
다음은 입주자가 확인중인 내 애플리케이션 컨트롤러입니다.
는 여기 http://railscasts.com/episodes/389-multitenancy-with-postgresql?view=commentsclass ApplicationController < ActionController::Base
protect_from_forgery
rescue_from CanCan::AccessDenied do |exception|
redirect_to root_path, :alert => exception.message
end
before_filter :mailer_set_url_options
def mailer_set_url_options
ActionMailer::Base.default_url_options[:host] = request.host_with_port
end
around_filter :scope_current_tenant
private
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
helper_method :current_user
def current_tenant
@current_tenant ||= Tenant.find_by_subdomain!(request.subdomain)
end
helper_method :current_tenant
def scope_current_tenant(&block)
current_tenant.scope_schema("public", &block)
end
end
내가 납니까 다른 문제가 유증 통해에서 railscast을 따랐다. 그것은 multitenant 때문에 나타나고 도우미 current_user를 정의하는 것은 응용 프로그램 컨트롤러에서 세션과 함께 까다롭게 놀고 있습니다, 어떤 아이디어입니까?
해결 방법을 찾으셨습니까? @richard – scanales
@scanales 아직 프로젝트를 찾지 못했습니다. 프로젝트가 보류 상태가되어 다음 프로젝트로 넘어갔습니다. 다시 돌아 가면 솔루션을 추가 할 것입니다. –