开发者

know the domain of the action called in rails

I have 2 domain: domain1.com and domain2.com

how can i know what is the domain that the user used to call a action?

like

domain1.com/开发者_C百科controller/action

i want get domain1.com from the action

is possible?

thanks


this should be possible by looking at the request object, see chapter 9.1 in the Guide.

domain(n=2)     The hostname’s first n segments, starting from the right (the TLD).

Hope this helps.


Use the host method. If you require the port as well, use host_with_port.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜