0
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

yujingz
  • 2,271
  • 1
  • 25
  • 29

2 Answers2

1

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.

Ian Connor
  • 76
  • 3
  • Thanks for the reply. I figured out the problem somehow, it's similar to the problem here http://stackoverflow.com/questions/11738924/incomplete-response-body-being-returned-from-rails-3-app-with-rabl The only difference is I'm using Unicorn + Nginx. I actaully don't know how to properly config Unicorn. Instead, I rewrote the rabl code and made the response shorter, then everything works fine. – yujingz Mar 17 '13 at 04:13
  • Nice - I have not done unicorn yet personally either. I am still using passenger and apache (yes I know 2010 called and wants its web stack back). – Ian Connor Mar 17 '13 at 18:50
0

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!

Community
  • 1
  • 1
yujingz
  • 2,271
  • 1
  • 25
  • 29