effective_datatables 4.13.1 → 4.13.3

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: d9144f742099923e8f4029b91ec95f0f72a7448a885d60f1c26512fe84740af3
4
- data.tar.gz: 75d5118016122bb723098f3b42c1110b4029b9f8485a16fdb6cf0bc6a13ae538
3
+ metadata.gz: 195e2fea792167d2a115b603eca328921936b989a2ee8250f927f2dc0e7c9135
4
+ data.tar.gz: 945313e0c3188ece78cd3a89ec0cad517f1e72b65424b51718887d1670d477ca
5
5
  SHA512:
6
- metadata.gz: 50b2cfbf7a71f94dd61e1891bae7688b974c14e072577c408a1ca17e064e8ff1885b76643eb5efaf6df1b9ceaa8fe2a51ce3587c4ec6cfc8478cb6e3fbc73514
7
- data.tar.gz: a702fed36f9a6a2fc489c3f8dd9367f6390f7b20b5f1d0a3a6cc7fda8b07957da376d8bf5795037b3e70f072c1fd278563c5fab0e478d827285af2aa5e16bd37
6
+ metadata.gz: 8a833adb0cdd8b0f98775b2245b1a6fd5d08c5237ba0f01e42e3e34fe3e170073e40c70d1d43af4670f9fbad2e838a8540be6d9d33cbbb987fb2ec97e6fbcc11
7
+ data.tar.gz: 6f3e823b061a30a69499dab532a2b385233409ef9c72b24a91aac25c7527244e88dfd304bff9ca2cf824ebc3b864b6b38e3ab503f79f361d1d89dccaca2031e2
@@ -22,6 +22,8 @@ module EffectiveDatatablesHelper
22
22
 
23
23
  datatable.view ||= self
24
24
 
25
+ datatable.state[:length] = 9999999 if simple
26
+
25
27
  unless EffectiveDatatables.authorized?(controller, :index, datatable.collection_class)
26
28
  return content_tag(:p, "You are not authorized to view this datatable. (cannot :index, #{datatable.collection_class})")
27
29
  end
@@ -36,20 +36,24 @@ module Effective
36
36
  EffectiveResources.with_resource_enumerator do |lines|
37
37
  lines << CSV.generate_line(csv_header)
38
38
 
39
- collection.public_send(csv_collection_method) do |resources|
40
- resources = arrayize(resources, csv: true)
39
+ if active_record_collection?
40
+ collection.find_in_batches do |resources|
41
+ resources = arrayize(resources, csv: true)
42
+ format(resources, csv: true)
43
+ finalize(resources)
44
+
45
+ resources.each { |resource| lines << CSV.generate_line(resource) }
46
+ end
47
+ else
48
+ resources = collection
49
+
41
50
  format(resources, csv: true)
42
51
  finalize(resources)
43
52
 
44
53
  resources.each { |resource| lines << CSV.generate_line(resource) }
45
54
  end
46
- end
47
- end
48
-
49
- private
50
55
 
51
- def csv_collection_method
52
- (active_record_collection? ? :find_in_batches : :to_a)
56
+ end
53
57
  end
54
58
 
55
59
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.13.1'.freeze
2
+ VERSION = '4.13.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.13.1
4
+ version: 4.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-23 00:00:00.000000000 Z
11
+ date: 2022-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails