Custom template handler

13 views
Skip to first unread message

Sampson Crowley

unread,
Jun 6, 2019, 12:11:09 PM6/6/19
to Ruby on Rails: Talk
Can someone please explain to me how I can access the main response object and headers in a template handler? I want to create a csv builder that streams row by row through a template instead of having to keep the whole code in the controller, but I can't even get a basic version working

Sample code here: https://stackoverflow.com/questions/56470157/rails-custom-actionviewtemplatehandler-no-data-sent

Joe Guerra

unread,
Jun 6, 2019, 1:27:57 PM6/6/19
to Ruby on Rails: Talk
Network error?  Where is that csv file your trying to load?

Sampson Crowley

unread,
Jun 6, 2019, 10:29:30 PM6/6/19
to Ruby on Rails: Talk
yeah chrome shows "Network Error" for the file, with no response body in the network tools. there are no errors on the rails side of things. what do you mean "where is the csv file"? its generated. that's the whole issue here

I figured out it was a "deflate" header that was being sent without the compression actually being used, and ended up building a gem that adds a responder to handle streaming instead of pre-rendering

Joe Guerra

unread,
Jun 7, 2019, 10:58:36 AM6/7/19
to Ruby on Rails: Talk
Great,  I thought you were trying to load a file.
Reply all
Reply to author
Forward
0 new messages