# Request.remote\_ip with AJAX

**URL:** <https://www.ruby-forum.com/t/request-remote-ip-with-ajax/184409>\
**Category:** Rails\
**Created:** [March 2, 2010, 2:22am UTC](https://www.ruby-forum.com/t/request-remote-ip-with-ajax/184409 "2010-03-02T02:22:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajaxrequest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@ajaxrequest](https://www.ruby-forum.com/u/ajaxrequest)\
**Post date:** [March 2, 2010, 2:22am UTC](https://www.ruby-forum.com/t/request-remote-ip-with-ajax/184409/1 "2010-03-02T02:22:06Z")

</div>

Hello everyone. I have a problem with “request.remote\_ip” I made an  
array:

1 ip = request.remote\_ip  
2 $ address [ip] = (: test =\> “OK”)  
…  
…  
…  
11 ip = request.remote\_ip # (along with a lot of AJAX calls)  
12 response = $ address [ip] [: test]  
It often works, but sometimes it gives me this error:

NoMethodError (undefined method `[] 'for nil: NilClass)  
app/controllers/my\_controller.rb:12…

and refers to the array. All this happens only when I have A LOT OF AJAX  
calls simultaneously. But it is possible that request.remote\_ip is  
“null” during the AJAX calls? Help me please.

---

<div class="post-metadata">

**Author:** ![ajaxrequest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@ajaxrequest](https://www.ruby-forum.com/u/ajaxrequest)\
**Post date:** [March 2, 2010, 6:25pm UTC](https://www.ruby-forum.com/t/request-remote-ip-with-ajax/184409/2 "2010-03-02T18:25:59Z")

</div>

anyone help me?
