I noticed that the Subdomain elevator first parses the subdomains and then returns the first one in the list in https://github.com/influitive/apartment/blob/development/lib/apartment/elevators/subdomain.rb#L37.
Examples:
- "bar.foo.com" would be ["bar"] and "bar" would be the subdomain.
- "baz.bar.foo.com" would be ["baz", "bar"] and "baz" would be the subdomain.
Base on the FirstSubdomain elevator, this seems like exactly the same since the FirstSubdomain just splits on "." and returns the first item. Seeing that we always get first in Subdomain, should link 37 not be something line:
def subdomain(host)
subdomains(host).join('.')
end
This way, following our example
- "bar.foo.com" would be ["bar"] and "bar" would be the subdomain/schema name
- "baz.bar.foo.com" would be ["baz", "bar"] and "baz.bar" would be the subdomain/schema name
FirstDomain should continue to work because in both cases, we'd still get "bar" and "baz".
Not sure if I'm mis-reading Subdomain implementation.
I noticed that the Subdomain elevator first parses the subdomains and then returns the first one in the list in https://github.com/influitive/apartment/blob/development/lib/apartment/elevators/subdomain.rb#L37.
Examples:
Base on the FirstSubdomain elevator, this seems like exactly the same since the FirstSubdomain just splits on "." and returns the first item. Seeing that we always get
firstin Subdomain, should link 37 not be something line:This way, following our example
FirstDomain should continue to work because in both cases, we'd still get "bar" and "baz".
Not sure if I'm mis-reading Subdomain implementation.