I’ve read this about rails actions,
‘Each action results in a response, which holds the headers and document
to be sent to the userâ€˜s browser. The actual response object is
generated automatically through the use of renders and redirects and
requires no user intervention.’
This seems to work and make sense when a browser makes the POST, however
we have a 3D engine called Unity contrsucting an HTTP POST to our server
which passes a thumbnail of a rendered image. The controller saves the
thumnail without any trouble and the method in the controller runs to
completion however the browser isn’t redirected as it should becuase it
is Unity (the 3D player) which made the HTTP POST and not the browser.
So the parent html view which loads the player just sits there hung.
My question is, is there a way to send an HTTP Response (with a
succesful status) back to the player to let it know that the save was
succesful, and at that point we can take an action to redirect the page
simplified code is as follows:
@virtual_item = VirtualItem.find(params[:id]) @virtual_item.name = params[:name] if @virtual_item.update_attributes(params[:virtual_item]) flash[:notice] = 'VirtualItem was successfully updated.' redirect_to :action => 'list' else render :action => 'edit' end
The attribute of @virtual_item always are successfully updated, but the
browser isn’t redirected to list. How do we send a response back to the
Unity engine which made the POST to the update method?
Thanks in advance.