lib/active_admin/resource_controller/streaming.rb in activeadmin-1.0.0.pre2 vs lib/active_admin/resource_controller/streaming.rb in activeadmin-1.0.0.pre3

- old
+ new

@@ -18,17 +18,23 @@ protected def stream_resource(&block) headers['X-Accel-Buffering'] = 'no' headers['Cache-Control'] = 'no-cache' - self.response_body = Enumerator.new &block + + if ActiveAdmin.application.disable_streaming_in.include? Rails.env + self.response_body = block[''] + else + self.response_body = Enumerator.new &block + end end def csv_filename "#{resource_collection_name.to_s.gsub('_', '-')}-#{Time.zone.now.to_date.to_s(:default)}.csv" end def stream_csv + headers['Content-Type'] = 'text/csv; charset=utf-8' # In Rails 5 it's set to HTML?? headers['Content-Disposition'] = %{attachment; filename="#{csv_filename}"} stream_resource &active_admin_config.csv_builder.method(:build).to_proc.curry[self] end end