Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix for NoMethodError: undefined method `remote_ip' for #<Sinatra::Request:0xb5e00f64> #343

Merged
merged 2 commits into from

3 participants

@agm1988

No description provided.

@agm1988

fix for NoMethodError: undefined method `remote_ip' for #Sinatra::Request:0xb5e00f64
When use sinatra as metal

@binarylogic binarylogic merged commit 4865742 into from
@bmulholland

Why was this change made? It means that as of 3.3.0, all user IP addresses are now the IP of our proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 18, 2013
  1. @agm1988

    Update lib/authlogic/session/magic_columns.rb

    agm1988 authored
    changed to ip
  2. @agm1988

    Update lib/authlogic/test_case/mock_request.rb

    agm1988 authored
    changed method to ip
This page is out of date. Refresh to see the latest.
View
6 lib/authlogic/session/magic_columns.rb
@@ -8,7 +8,7 @@ module Session
# last_request_at Updates every time the user logs in, either by explicitly logging in, or logging in by cookie, session, or http auth
# current_login_at Updates with the current time when an explicit login is made.
# last_login_at Updates with the value of current_login_at before it is reset.
- # current_login_ip Updates with the request remote_ip when an explicit login is made.
+ # current_login_ip Updates with the request ip when an explicit login is made.
# last_login_ip Updates with the value of current_login_ip before it is reset.
module MagicColumns
def self.included(klass)
@@ -58,7 +58,7 @@ def update_info
if record.respond_to?(:current_login_ip)
record.last_login_ip = record.current_login_ip if record.respond_to?(:last_login_ip)
- record.current_login_ip = controller.request.remote_ip
+ record.current_login_ip = controller.request.ip
end
end
@@ -92,4 +92,4 @@ def last_request_at_threshold
end
end
end
-end
View
4 lib/authlogic/test_case/mock_request.rb
@@ -7,7 +7,7 @@ def initialize(controller)
self.controller = controller
end
- def remote_ip
+ def ip
(controller && controller.respond_to?(:env) && controller.env.is_a?(Hash) && controller.env['REMOTE_ADDR']) || "1.1.1.1"
end
@@ -16,4 +16,4 @@ def method_missing(*args, &block)
end
end
end
-end
Something went wrong with that request. Please try again.