streaming doesn't work when XML/CSV is rendered in template #3063

Closed
sradu opened this Issue Sep 18, 2011 · 6 comments

Projects

None yet

4 participants

@sradu
sradu commented Sep 18, 2011

I have a controller action like:

def export
@store = Store.find_by_unique_code(params[:unique_code])
unless @store
render :nothing => true
return
end

respond_to do |format|
  format.xml { render :stream => true }
  format.csv { render :stream => true }
end

end

In export.xml.erb

<% @store.products.each do |p| -%>
<%= render_store_products_xml(p).html_safe -%>
<% end %>

:stream => true doesn't seem to do anything, Rails doesn't answer at all. The docs say that render :json and render :xml doesn't work, but templating does.

@rmehner
rmehner commented Oct 27, 2011

Having the same issue here.

Controller:

def show
  @product = Product.find(params[:id])
  render stream: true
end

Nothing more than that. When I have the same view but as HTML streaming works like expected.

View (show.csv.erb):

<% @product.categories.each do |category| %>
  <%= category.name %>
<% end %>
@upstream
upstream commented Nov 7, 2011
  • 1 Same problem here.
@jeremyf
jeremyf commented Apr 29, 2012

@sradu Is this still an issue?

(@jeremyf)

@sradu
sradu commented Apr 29, 2012

I went with another solution, using a simple sinatra app just for this. The issue can be closed from my point of view.

Thanks!

@jeremyf
jeremyf commented Apr 29, 2012

@sradu Can you go ahead and close the issue?

@sradu
sradu commented Apr 29, 2012

Closed.

@sradu sradu closed this Apr 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment