rails/rails — pull request #16604 by saarons (2014-08-21 06:34:00+00:00)
Title: Refactor ActionDispatch::RemoteIp

Refactored IP address checking in `ActionDispatch::RemoteIp` to rely on
the `IPAddr` class instead of the unwieldly regular expression to match
IP addresses. This commit keeps the same api but allows users to pass
`IPAddr` objects to `config.action_dispatch.trusted_proxies` in addition
to passing strings and regular expressions.

Example:

# config/environments/production.rb
config.action_dispatch.trusted_proxies = IPAddr.new('4.8.15.16')