rhtml - controller race - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

rhtml - controller race

whiteadiwhiteadi Posts: 1Member
here is my problem:

One user, one (new) modem, one computer. He wants to connect to Internet
with the modem.

The user that wants to connect with the modem first is redirected to
ruby application (by modem firmware -> www-is on VPN), after configuring
the settings the redirect is removed but the rhtml is not rendered
because the application (web/ruby) is on VPN and it has no access
anymore to it.

Now, I am a beginner to ruby but I did some tries and searches and still
cannot make it that the text and some links that say yey u are
successfully connected to internet, here you have some docs about it...,
to be first displayed and then the settings to take effect and redirect
removed... in the same step, controller method <-> rhtml. The settings
they take effect and some text or none is displayed, it is a race on
what is first, rendering the rhtml or controllers method with get
requests to the modem is executed ... first.

Thanks guys!

what I am still looking for is a way of first to display the rhtml and after fire the get requests.

One request is like this:

url = URI.parse("http://"+ session[:ip_addr] + "/blabla.wl?var1=1&...")
req = Net::HTTP::Get.new(url.path+"?"+url.query)
req.basic_auth "xxx","xxx"
res = Net::HTTP.start(url.host, url.port) {|http| http.request(req)}

and now is in controller, but I did try it in between <% %> in template rhtml but didn't displayed the template also.
Sign In or Register to comment.