Backbone paginator + Rails dosen't work in production server

180 Views Asked by At
parse: (response, options) =>
  @totalRecords = parseInt(response.result_count)
  @totalPages = Math.ceil(@totalRecords / @perPage)
  response.data

Works perfectly on local dev env, local production env. But when deployed to production, the parse function can't get any data back(it was even not triggerd).

Played in the browser console, use collection.fetch(), it has response, but just can't pass it into my collection.

enter image description here

2

There are 2 best solutions below

0
On BEST ANSWER

Thanks to @bodacious I was able to solve this. It's a server side thing. For nginx+unicorn case, just add

proxy_buffering off

to your location block in nginx.conf, and everything works again!

References here: Incomplete response body being returned from Rails 3 app with RABL

Thank you all!

2
On

Sounds like it is not a code problem so much as a deployment issue. If you can get production working locally, this should mean your code works.

Could the problem be either the assets are not precompiled when they are needed (or not updated on the production server). Remember with Heroku and some providers you need to push the precompiled assets when you deploy or ensure they get build on the server.