Rails获取IP地址

Rails获取IP地址

#rails 3 中可以通过request.remote_ip 获取来源ip
request.remote_ip


# 而@env["action_dispatch.remote_ip"] 的声明在 ./actionpack-3.2.11/lib/action_dispatch/middleware/remote_ip.rb 中

vim /usr/local/rvm/gems/ruby-1.9.3-p194/gems/action_dispatch/middleware/remote_ip.rb

This entry was posted in ruby on Rails

Leave a Reply

电子邮件地址不会被公开。

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">