How to capture IP address in ruby 1.8.7

Hi all, I want to capture IP address in ruby 1.8.7 can any one help me
out
how to capture IP.

Thanks in advance

I have tried with request.remote_ip.But this works in rails not in ruby.
I
have to pass ip address as a parameter.

How about using request.remote_addr ?

Regards,
Seeni Rafiyullah Khan A,
[email protected]**

Thanks Rafi for your reply but can I use request.remore_addr directly
like
ip = request.remote_addr in ruby. it is saying undefined request local
vairable.

Can you copy your ruby script ?

Regards,
Logan

Sent from mobile device

The controller is intended to handle things related to the request and
response. Are you trying this out when you are inside the model?? If so,
then you can’t access the request inside model.

Regards,
Seeni Rafiyullah Khan A

On Tue, Jun 18, 2013 at 3:05 AM, sameena Khan

ip = request.remote_addr
NameError: undefined local variable or method `request’ for
#Object:0xb785f950
from (irb):1
from :0
Which I am getting in irb.

On Tue, Jun 18, 2013 at 12:40 PM, Loganathan S. <

You cannot get this value in irb… Controller only intended to handle
the
request & response. Can you try that in some controller method?

Regards,
Seeni Rafiyullah Khan A,
[email protected]In Every moment, thank God.

On Tue, Jun 18, 2013 at 3:35 AM, sameena Khan

ok Rafi Thank you

Hey Khan.

Here you have some examples:

El martes, 18 de junio de 2013 00:56:02 UTC-5, Khan escribi: