I tried the following:
In user.rb
:
before_create :record_sign_up_ip
protected
def record_sign_up_ip
self.sign_up_ip = current_sign_in_ip
end
Unfortunately, although current_sign_in_ip
has my correct local ip of 127.0.0.1
, sign_up_ip
remains as nil
. How can I easily get the IP of someone signing up? Normally I would put this in the create
controller, but with Devise, there is no controller for User
.