How can I pass the subdomain as a value to search for a record in Rails 2?
I want to be able to send users to the following styled-URL:
subdomain.mydomain.com/tag
I have a LandingPage record, and so would like to be able to search for the specific LandingPage record by matching the method LandingPage.subdomain with the value in subdomain.
开发者_JAVA百科I would then want to store the value found in tag when someone submits a form on that page.
How can I do this without creating in my DNS or in Zerigo the specific subdomain in the URL? I'd like it to respond to a wildcard, but use the value to do a record search of an ActiveRecord.
Ryan does something very similar in his Railcast on subdomains: http://railscasts.com/episodes/221-subdomains-in-rails-3
精彩评论