Thursday, 5 September 2013

How to send two responses in Rails

How to send two responses in Rails

I am looking to create an application that accepts an uploaded photo,
writes the photo, then uploads it to a backup server. I would like it to
send to the browser a JSON response stating processing: true when it's
uploading to the backup server, and then success: true when it
successfully uploads to the backup server.
I know about response.stream.write in Rails, but when I use this, it sends
one response with both of my json objects instead of two responses with
one json object each. How do I do two separate responses? Do I need to
request the page twice or is there a way for the page to send the request
automatically?

No comments:

Post a Comment