Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
16 lines (12 sloc) 350 Bytes
class ApplicationController < ActionController::Base
protect_from_forgery
around_filter :with_tenant
protected
attr_reader :current_tenant
def with_tenant
@current_tenant = Tenant.find_by_host!(request.host)
@current_tenant.with { yield }
rescue ActiveRecord::RecordNotFound
render "no_such_tenant"
end
end