开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜