How does one go about finding the remote address of an HTTP request in
Rails? I''ve got a fairly vanilla Rails application with the following
code:
class GuestController < ApplicationController
@remote_ip = request.env["REMOTE_ADDR"]
...
end
The GuestController was created using the "generate controller"
command
and hasn''t been significantly modified.
When I try to run this (display a page), I get the error:
undefined local variable or method `request'' for GuestController:Class
I assume that this is a scoping issues. According to the docs it looks
like request.env is implemented in ApplicationController''s parent
ActionController. Why doesn''t this method call go up the inheritance
chain? Seems like I''m missing something basic here.
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---