Hi-
I have a rails app where a form gets submitted, and that data from the
form has to be validated. It's a widget app, so other sites will use
the validation routine, but I also want to use it myself, from the
same server that does the validation. So, is it possible for a ruby
instance to send a post to the same server? I try this in development
but it freezes up and I eventually get a timeout error. The code
looks like this:
def verify_home
@response = "An error has occurred."
if params[:widget_id] and params[:widget_answer]
result = Net::HTTP.post_form(URI.parse('http://localhost:3000/
questions/verify'),
{'widget_id' => params[:widget_id], 'widget_answer' =>
params[:widget_answer])
if result.include? "success"
@response = "Correct!"
end
end
redirect_to :action => "index"
end
So, the "questions/verify" method works just fine on its own (when
submitted from a different site), but freezes up when I send it from
the current server to itself.
Any advice?
Thanks,
Dino