diff options
author | Yehuda Katz <wycats@gmail.com> | 2011-11-15 13:59:31 -0800 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2011-11-15 13:59:31 -0800 |
commit | 6491aadc525b8703708e0fd0fbf05bd436a47801 (patch) | |
tree | 91658386bb53d1f4b075146eba1e1a4a9cb6a9e2 /actionpack/lib/action_dispatch/http | |
parent | 83bf0b626cf2134260903e57d74f67de57384073 (diff) | |
parent | d743954792ccf5975a11ee88cdd690e8f1915728 (diff) | |
download | rails-6491aadc525b8703708e0fd0fbf05bd436a47801.tar.gz rails-6491aadc525b8703708e0fd0fbf05bd436a47801.tar.bz2 rails-6491aadc525b8703708e0fd0fbf05bd436a47801.zip |
Merge pull request #3640 from indirect/remote_ip
GetIp#to_s should never return nil. That's icky.
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r-- | actionpack/lib/action_dispatch/http/request.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index b10f6b48c7..0e8bd0bd6d 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -155,10 +155,9 @@ module ActionDispatch @ip ||= super end - # Originating IP address, usually set by the RemoteIp middleware. + # Originating IP address from the RemoteIp middleware. def remote_ip - # Coerce the remote_ip object into a string, because to_s could return nil - @remote_ip ||= @env["action_dispatch.remote_ip"].to_s || ip + @remote_ip ||= @env["action_dispatch.remote_ip"] end # Returns the unique request id, which is based off either the X-Request-Id header that can |