Search code examples
ruby-on-railsbackbone.jsbackbone.paginator

Backbone paginator + Rails dosen't work in production server


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


Solution

  • 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!