active_report 5.2.6 → 5.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9e4cbb42e5657ad07cf960f5b6eb511f5a9bf8849a4da2186df559e0d7b834e
4
- data.tar.gz: 4f067fb60f4258ac44a45be3467ec20be895c9e0e12278c28df3c6b8a205fa80
3
+ metadata.gz: 8bde1de5a7f2f2eea8844b30fd811eb3bde0026344bd5c83386995ac0f40d6a8
4
+ data.tar.gz: 0624ceb3f8ded798a662f235eab1050c26ad4fab3ceac2e01d19f44dbdcf2cab
5
5
  SHA512:
6
- metadata.gz: 8f0ca6edd0b24691e27a6da356dbc853774225fe92708b8299b9f84970148d7c5fa62565e630d6fb8082a809a2a32248e0ee607a390a426cdc8ecba3c0780588
7
- data.tar.gz: 86218db0fe6b563a9b61144502dfd45884f17a47fd902887a766337f7d55b0fceca498ecaf172098b6ad3db3ca159bad1145044c3afae0402204972233f5b5cd
6
+ metadata.gz: a314a3fd29f83176b240c40c4a0f9c246c34d849e67dd557a3bec6d33d715377b1ed9a5f59b104b4cf5edbc031c76128d43e1207908995d154a9f5e224302c3f
7
+ data.tar.gz: 2799ed6b5c9e652f9a17b491cbacf1a8f132de1672017cbf120372eed28d799c9333a896e695b591e2174f4d38a0ad8e0255169442572fb334cf81d775f35acf
@@ -54,29 +54,35 @@ class ActiveReport::Record < ActiveReport::Base
54
54
  private
55
55
 
56
56
  def export_csv
57
+ @data = @data.result if @data.is_a?(Ransack::Search)
58
+
57
59
  CSV.generate(@opts[:options]) do |csv|
58
60
  csv << @opts[:headers]
59
-
60
- @data.find_each(start: @opts[:start],
61
- finish: @opts[:finish],
62
- batch_size: @opts[:batch_size],
63
- error_on_ignore: @opts[:error_on_ignore]) do |row|
61
+ @data.find_each(find_each_options) do |row|
64
62
  csv << filter_values(row.attributes)
65
63
  end
66
64
  end
67
65
  end
68
66
 
69
67
  def export_stream
68
+ @data = @data.result if @data.is_a?(Ransack::Search)
69
+
70
70
  Enumerator.new do |csv|
71
71
  csv << CSV.generate_line(@opts[:headers])
72
72
 
73
- @data.find_each(start: @opts[:start],
74
- finish: @opts[:finish],
75
- batch_size: @opts[:batch_size],
76
- error_on_ignore: @opts[:error_on_ignore]) do |row|
73
+ @data.find_each(find_each_options) do |row|
77
74
  csv << CSV.generate_line(filter_values(row.attributes))
78
75
  end
79
76
  end
80
77
  end
81
78
 
79
+ def find_each_options
80
+ {
81
+ start: @opts[:start],
82
+ finish: @opts[:finish],
83
+ batch_size: @opts[:batch_size],
84
+ error_on_ignore: @opts[:error_on_ignore]
85
+ }
86
+ end
87
+
82
88
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveReport
4
- VERSION ||= '5.2.6'
4
+ VERSION ||= '5.2.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.6
4
+ version: 5.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez