mbleigh / subdomain-fu

A new plugin approach to attempting to solve the usage of subdomains in linking and routing in Rails projects.
http://rdoc.info/projects/mbleigh/subdomain-fu
Other
586 stars 118 forks source link

current_subdomain returns the more than just the subdomain #6

Closed benschwarz closed 9 years ago

benschwarz commented 14 years ago

I have a hosts entry pointing x.localhost.com to 127.0.0.1 When I inspect current_subdomain while using x.localhost.com:3000 I get

x.localhost.

This is using rails 2.3.5.

benschwarz commented 14 years ago

This is probably done purposely - but I think anyone who is expecting to use a real subdomain with your library would probably expect to use "real" hosts during development.

ctcherry commented 14 years ago

This can be controlled via configuration. In your case you need tld_size for development environment to be 1. Put this in an initializer (rails), or some other code that is run once at application start. SubdomainFu.tld_sizes = { :development => 1, :test => 0, :production => 1}

benschwarz commented 14 years ago

Yes I understand the configuration, I just think that the default should be to expect a subdomain host - Its the least surprising course of action, considering that the library is for handling subdomains.

jc00ke commented 14 years ago

I just tried subdomain_fu using Tim Pope's http://j.mp/smackahost and for test.smackaho.st it's returning test.smackaho for the current_subdomain. That seems odd for a default configuration to return like that.