Quoting Walter Lee Davis <[email protected]>:
> 
> On Jan 13, 2011, at 12:36 PM, Donald R. Ziesig wrote:
> 
> >I restrict the ip to 0.0.0.0 (localhost) so no one outside the
> >server can use the route.  If someone is able to hack into the
> >server itself, all bets are off. :-( .  So far I haven't had any
> >problems, and the site has been up for 3.5 years so far.
> >
> >local_request? would work too.
> 
> 
> I need to do something similar -- keep all but cron requests from
> the same server from tripping a particular method in my controller.
> Can you elaborate on how local_request? could be used for that
> purpose? I looked at the documentation, and it appears to be a test
> you can run on an exception, but I'm not clear how to employ it --
> what would I use to raise the exception in the first place?
> 
> Is it as simple as this?
> 
> def my_api_method
>       send_out_a_bunch_of_mail if local_request?
> end
> 
> My gut tells me no, there's an object missing here.
> 

The object is an ActiveController instance, i.e. an HTTP request handler.  The
method checks the IP address of the requester.

Jeffrey

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to