开发者

know the domain of the action called in rails

开发者 https://www.devze.com 2022-12-13 02:50 出处:网络
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?

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

精彩评论

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