11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/models/bjond_registration.rb', line 11
def self.find_registration_by_remote_request(request)
ip = Resolv.getaddress(request.ip)
result = BjondRegistration.find_by_ip(ip)
if (!result.nil?)
return result
end
host = Resolv.getname(ip)
host_result = BjondRegistration.find_by_host(host)
if (!host_result.nil?)
return host_result
end
puts 'Warning! No BjondRegistration found for ip: ' + ip + '. This IP resolves to ' + host + 'Trying most recent registration. '
puts 'Incoming request parameters: '
ap request
return BjondRegistration.last
end
|