I forgot to add that both account and user models are on public schema,
outside of tenants.



2015-06-15 12:49 GMT-03:00 Leandro França <[email protected]>:

> Hi there,
>
> 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]
>
>
>   def self.find_for_authentication(warden_conditions)
>     where(:email => warden_conditions[:email], :subdomain =>
> warden_conditions[:subdomain]).first
>   end
> end
>
>
> 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,
> Leandro
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/517f8155-1bb5-4495-8f82-b8f5a0693148%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/517f8155-1bb5-4495-8f82-b8f5a0693148%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAAt6bOqWoM-66BFUEJ_rYS%3DutCG3j4FQiT1A98_Guyyt8KxmYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to