Are Rails 3 Subdomains Fairly Painless?
I have an app with two sections, Buyers and Sellers. The main section '/' is for Buyers, but I have a separate Sellers portal that I'm currently placing in /sellers. Might be nicer to move the sellers to their own subdomain like 'sellers.mydomain.co开发者_StackOverflow社区m'.
Subdomains don't seem to be extremely popular and I've read things like they make testing difficult, etc. Wondering what you all have to say about the issue.
There are a few things that make testing a bit of pain with subdomains, but introducing subdomains as a real supported feature in rails 3 has somewhat mitigated these problems.
EDIT: Adding something like this to your test helper can make testing a lot easier and more readable.
def set_subdomain(sub)
@request.host = sub.present?? "#{sub}.test.host" : "test.host"
end
EDITx2:
http://www.railscasts.com/episodes/221-subdomains-in-rails-3
精彩评论