mirror of
https://github.com/github/rails.git
synced 2026-01-11 15:48:10 -05:00
Return the calculated remote_ip or ip
This was an especially nasty bug introduced in 317f4e2, by the way that an instance of GetIp is not nil, but GetIp#to_s could sometimes return nil. Gross, huh?
This commit is contained in:
@@ -157,7 +157,8 @@ module ActionDispatch
|
||||
|
||||
# Originating IP address, usually set by the RemoteIp middleware.
|
||||
def remote_ip
|
||||
@remote_ip ||= (@env["action_dispatch.remote_ip"] || ip).to_s
|
||||
# Coerce the remote_ip object into a string, because to_s could return nil
|
||||
@remote_ip ||= @env["action_dispatch.remote_ip"].to_s || ip
|
||||
end
|
||||
|
||||
# Returns the unique request id, which is based off either the X-Request-Id header that can
|
||||
|
||||
Reference in New Issue
Block a user