Custom template handler

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom template handler

Sampson Crowley
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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a981f28a-ac0c-40b0-b5df-43ed256e0cec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom template handler

Joe Guerra
Network error?  Where is that csv file your trying to load?

On Thursday, June 6, 2019 at 12:11:09 PM UTC-4, Sampson Crowley wrote:
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: <a href="https://stackoverflow.com/questions/56470157/rails-custom-actionviewtemplatehandler-no-data-sent" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F56470157%2Frails-custom-actionviewtemplatehandler-no-data-sent\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE8rnvvajaeAH84Klp3SXAyCI89TA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F56470157%2Frails-custom-actionviewtemplatehandler-no-data-sent\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE8rnvvajaeAH84Klp3SXAyCI89TA&#39;;return true;">https://stackoverflow.com/questions/56470157/rails-custom-actionviewtemplatehandler-no-data-sent

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6df602bf-8053-429b-9c70-122a78ab50bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom template handler

Sampson Crowley
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

On Thursday, June 6, 2019 at 11:27:57 AM UTC-6, Joe Guerra wrote:
Network error?  Where is that csv file your trying to load?

On Thursday, June 6, 2019 at 12:11:09 PM UTC-4, Sampson Crowley wrote:
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: <a href="https://stackoverflow.com/questions/56470157/rails-custom-actionviewtemplatehandler-no-data-sent" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F56470157%2Frails-custom-actionviewtemplatehandler-no-data-sent\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE8rnvvajaeAH84Klp3SXAyCI89TA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F56470157%2Frails-custom-actionviewtemplatehandler-no-data-sent\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE8rnvvajaeAH84Klp3SXAyCI89TA&#39;;return true;">https://stackoverflow.com/questions/56470157/rails-custom-actionviewtemplatehandler-no-data-sent

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/42d36dd6-5169-4da8-902e-dc7e41d37992%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom template handler

Joe Guerra
Great,  I thought you were trying to load a file.

On Thursday, June 6, 2019 at 10:29:30 PM UTC-4, Sampson Crowley wrote:
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

On Thursday, June 6, 2019 at 11:27:57 AM UTC-6, Joe Guerra wrote:
Network error?  Where is that csv file your trying to load?

On Thursday, June 6, 2019 at 12:11:09 PM UTC-4, Sampson Crowley wrote:
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: <a href="https://stackoverflow.com/questions/56470157/rails-custom-actionviewtemplatehandler-no-data-sent" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F56470157%2Frails-custom-actionviewtemplatehandler-no-data-sent\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE8rnvvajaeAH84Klp3SXAyCI89TA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F56470157%2Frails-custom-actionviewtemplatehandler-no-data-sent\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE8rnvvajaeAH84Klp3SXAyCI89TA&#39;;return true;">https://stackoverflow.com/questions/56470157/rails-custom-actionviewtemplatehandler-no-data-sent

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b24f2597-ba0c-4a59-add0-8f86ad894be8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.