Friday, 6 September 2013

Rails acts_as_tenant - access current tenant

Rails acts_as_tenant - access current tenant

I have added the gem 'acts_as_tenant' to my Rails app.
I have set the following in the application controller:
set_current_tenant_by_subdomain(:tenant, :subdomain)
I have also added columns of information to the Tenants table. For
instance the statuscode_id for a 'closed' status. In the Request model, I
would like to scope using that column.
Something like this:
scope :closed, where(:statuscode_id =>
Tenant.find(current_tenant.id).request_closed)
But, current_tenant isn't working.
What can I use to get the id of the current tenant?
Thanks!

No comments:

Post a Comment