Topic: Anyone got a good tutorial for using Using Net::HTTP.get_response ?

Im trying to use Net::HTTP.get_response to include some static pages into results pages of a RoR app but whenever I use it I seem to crash my app. Has anyone got a decent tutorial they can point me at?

I'm trying to use something like

    @webdetails = Net::HTTP.get_response( URI.parse('http://www.mypages.com/programaticallysetpage.html' ) )

and then rendering the @webdetails instance variable in the show.html.erb

Re: Anyone got a good tutorial for using Using Net::HTTP.get_response ?

here is small code sample I put together recently
http://house9-code-samples.blogspot.com … p-get.html
maybe it will help you?

be careful in dev mode if you are actually getting response of your own pages when both are being served up off the same port, for example your code above targeted at localhost

# say this is in some action on DoStuffController
@webdetails = Net::HTTP.get_response(URI.parse('http://localhost:3000/programaticallysetpage.html' ))

if the controller executing this line of code is http://localhost:3000/do_stuff
when it hits the line to make the http request it will be blocking itself as there is only one process running on port 3000 and it is in use; you might run into the same issue on production if you only have one process running there

I hope I explained that ok, re-reading it, I confused myself smile