开发者

Rails 3 urls with subdomains

I have a rails app that has members that belongs to an organisation.

When members login they now get a url like this

www.DOMAIN/organisations/ORGANISATION_ID

I want to change this to

www.organisation_name.DOM开发者_如何学编程AIN (What do we call a url like this?)

How can I do this?

A small add


For Rails 2.3 you will need some plugins, for Rails 3 not. I suggest to watch these screen-casts: subdomains in rails 3 and subdomains.


I personally use subdomain_fu, which is great for parsing the subdomain of a request and mapping it to a user account.

You can find it here: https://github.com/mbleigh/subdomain-fu

I'm not sure if it is ready for Rails 3, though.


I have just written an up-to-date brief covering a plentitude of aspects on the subject: http://mines.mouldwarp.com/2012/11/subdomains-in-rails-apps-current-brief.html

It however assumes a fair amount of prior knowledge. The ROR guides and the aforementioned railscasts are thus recommended beforehand.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜