What I am trying to accomplish is simple. I am using Rails and CoffeeScript (and S3).
-
User Drags a file onto a drop area for uploading.
-
CoffeeScript sends an xmlHTTP request to a Rails controller action to get a signed URL for the S3 request.
-
Rails creates a record for the upload, creates a signed request URL, and sends back a JSON object that contains the signed URL as well as an upload-id for progress events and what not.
Since I have the Rails action responding with JSON, I can’t have rails also render a .js.coffee(.erb) file to update a partial containing an upload count.
Is there a convenient way to accomplish both of these tasks with a single request??
Thank you for any help 🙂
instead of using a js.erb, use render_to_string method for the partial and send it with the json response