I"m building a multitenant app using apartment and devise, using postgresql schemas and subdomain auth.
I just added subdomain , following this: https://github.com/plataformatec/devise/wiki/How-to:-Scope-login-to-subdomain
Everything is working, but this model requires that I have a subdomain attribute on user model:
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, request_keys: [:subdomain]
where(:email => warden_conditions[:email], :subdomain => warden_conditions[:subdomain]).first
I would like to validate subdomain from an account model, which is related to my user model. (User has many accounts. Account has a subdomain attribute).
How can I achieve this?
Thanks in advance,