activeadmin 2.11.2 → 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activeadmin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -0
- data/CONTRIBUTING.md +1 -1
- data/docs/0-installation.md +1 -1
- data/docs/5-forms.md +2 -1
- data/docs/Gemfile.lock +12 -12
- data/lib/active_admin/application.rb +4 -4
- data/lib/active_admin/csv_builder.rb +2 -16
- data/lib/active_admin/namespace.rb +2 -2
- data/lib/active_admin/pundit_adapter.rb +54 -11
- data/lib/active_admin/resource_controller/data_access.rb +27 -2
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b3beb756b607b196f72d4ec4a4b173867021bb2eba03d183797165810a526b5
|
4
|
+
data.tar.gz: bed4421fc6a28f2ff0bee9659a76bfd680b9432c74d290753c62392c3a7048d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11cce1d23fb4519f394ef13930716fabe39e6d7654f5c4424c887fe54e6d56225700155ae59187ad42a6551d9bcf17f95652c08d234ddafb5ba2d4fb5e444a09
|
7
|
+
data.tar.gz: 452592e57f8fe9f16e683a2f54b9dc7fdd717d1ec2db909710a07cfb74dda5d8f7a0efda515b439555470381da020e75b2d4dfe328a8b52bc436b2f94371525b
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,45 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 2.13.1 [☰](https://github.com/activeadmin/activeadmin/compare/v2.13.0..v2.13.1)
|
6
|
+
|
7
|
+
### Bug Fixes
|
8
|
+
|
9
|
+
* Honor load paths order when loading admin files. [#7488] by [@tf]
|
10
|
+
* Fix passing expected hash payload argument. [#7487] by [@ispyropoulos]
|
11
|
+
|
12
|
+
## 2.13.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.12.0..v2.13.0)
|
13
|
+
|
14
|
+
### Documentation
|
15
|
+
|
16
|
+
* Update validation errors documentation to account for deprecated `ActiveModel::Errors#keys`. [#7475] by [@amit]
|
17
|
+
|
18
|
+
### Dependency Changes
|
19
|
+
|
20
|
+
* Drop rails 6.0 support. [#7476] by [@deivid-rodriguez]
|
21
|
+
|
22
|
+
### Performance
|
23
|
+
|
24
|
+
* Fix pundit performance. [#7479] by [@deivid-rodriguez]
|
25
|
+
|
26
|
+
## 2.12.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.11.2..v2.12.0)
|
27
|
+
|
28
|
+
### Enhancements
|
29
|
+
|
30
|
+
* Add Ransack 3 compatibility. [#7453] by [@tagliala]
|
31
|
+
|
32
|
+
### Bug Fixes
|
33
|
+
|
34
|
+
* Fix pundit namespace detection. [#7144] by [@vlad-psh]
|
35
|
+
|
36
|
+
### Documentation
|
37
|
+
|
38
|
+
* Don't mention webpacker as the default asset generator in Rails. [#7377] by [@jaynetics]
|
39
|
+
|
40
|
+
### Performance
|
41
|
+
|
42
|
+
* Avoid duplicate work when downloading CSV. [#7336] by [@deivid-rodriguez]
|
43
|
+
|
5
44
|
## 2.11.2 [☰](https://github.com/activeadmin/activeadmin/compare/v2.11.1..v2.11.2)
|
6
45
|
|
7
46
|
### Bug Fixes
|
@@ -736,6 +775,7 @@ Please check [0-6-stable] for previous changes.
|
|
736
775
|
[#6959]: https://github.com/activeadmin/activeadmin/pull/6959
|
737
776
|
[#7095]: https://github.com/activeadmin/activeadmin/pull/7095
|
738
777
|
[#7127]: https://github.com/activeadmin/activeadmin/pull/7127
|
778
|
+
[#7144]: https://github.com/activeadmin/activeadmin/pull/7144
|
739
779
|
[#7170]: https://github.com/activeadmin/activeadmin/pull/7170
|
740
780
|
[#7181]: https://github.com/activeadmin/activeadmin/pull/7181
|
741
781
|
[#7205]: https://github.com/activeadmin/activeadmin/pull/7205
|
@@ -744,12 +784,20 @@ Please check [0-6-stable] for previous changes.
|
|
744
784
|
[#7262]: https://github.com/activeadmin/activeadmin/pull/7262
|
745
785
|
[#7293]: https://github.com/activeadmin/activeadmin/pull/7293
|
746
786
|
[#7332]: https://github.com/activeadmin/activeadmin/pull/7332
|
787
|
+
[#7336]: https://github.com/activeadmin/activeadmin/pull/7336
|
747
788
|
[#7340]: https://github.com/activeadmin/activeadmin/pull/7340
|
748
789
|
[#7341]: https://github.com/activeadmin/activeadmin/pull/7341
|
749
790
|
[#7349]: https://github.com/activeadmin/activeadmin/pull/7349
|
750
791
|
[#7350]: https://github.com/activeadmin/activeadmin/pull/7350
|
792
|
+
[#7377]: https://github.com/activeadmin/activeadmin/pull/7377
|
751
793
|
[#7384]: https://github.com/activeadmin/activeadmin/pull/7384
|
752
794
|
[#7394]: https://github.com/activeadmin/activeadmin/pull/7394
|
795
|
+
[#7453]: https://github.com/activeadmin/activeadmin/pull/7453
|
796
|
+
[#7475]: https://github.com/activeadmin/activeadmin/pull/7475
|
797
|
+
[#7476]: https://github.com/activeadmin/activeadmin/pull/7476
|
798
|
+
[#7479]: https://github.com/activeadmin/activeadmin/pull/7479
|
799
|
+
[#7487]: https://github.com/activeadmin/activeadmin/pull/7487
|
800
|
+
[#7488]: https://github.com/activeadmin/activeadmin/pull/7488
|
753
801
|
|
754
802
|
[@1000ship]: https://github.com/1000ship
|
755
803
|
[@5t111111]: https://github.com/5t111111
|
@@ -760,6 +808,7 @@ Please check [0-6-stable] for previous changes.
|
|
760
808
|
[@alejandroperea]: https://github.com/alejandroperea
|
761
809
|
[@alex-bogomolov]: https://github.com/alex-bogomolov
|
762
810
|
[@amiel]: https://github.com/amiel
|
811
|
+
[@amit]: https://github.com/amit
|
763
812
|
[@amiuhle]: https://github.com/amiuhle
|
764
813
|
[@andreslemik]: https://github.com/andreslemik
|
765
814
|
[@bartoszkopinski]: https://github.com/bartoszkopinski
|
@@ -796,11 +845,13 @@ Please check [0-6-stable] for previous changes.
|
|
796
845
|
[@innparusu95]: https://github.com/innparusu95
|
797
846
|
[@ionut998]: https://github.com/ionut998
|
798
847
|
[@irmela]: https://github.com/irmela
|
848
|
+
[@ispyropoulos]: https://github.com/ispyropoulos
|
799
849
|
[@Ivanov-Anton]: https://github.com/Ivanov-Anton
|
800
850
|
[@jasl]: https://github.com/jasl
|
801
851
|
[@javawizard]: https://github.com/javawizard
|
802
852
|
[@javierjulio]: https://github.com/javierjulio
|
803
853
|
[@jawa]: https://github.com/jawa
|
854
|
+
[@jaynetics]: https://github.com/jaynetics
|
804
855
|
[@JiiHu]: https://github.com/JiiHu
|
805
856
|
[@jiikko]: https://github.com/jiikko
|
806
857
|
[@johnnyshields]: https://github.com/johnnyshields
|
@@ -853,6 +904,7 @@ Please check [0-6-stable] for previous changes.
|
|
853
904
|
[@stereoscott]: https://github.com/stereoscott
|
854
905
|
[@tagliala]: https://github.com/tagliala
|
855
906
|
[@taralbass]: https://github.com/taralbass
|
907
|
+
[@tf]: https://github.com/tf
|
856
908
|
[@tiagotex]: https://github.com/tiagotex
|
857
909
|
[@timoschilling]: https://github.com/timoschilling
|
858
910
|
[@TimPetricola]: https://github.com/TimPetricola
|
data/CONTRIBUTING.md
CHANGED
@@ -63,7 +63,7 @@ If you want to test against a Rails version different from the latest, make sure
|
|
63
63
|
you use the correct Gemfile, for example:
|
64
64
|
|
65
65
|
```sh
|
66
|
-
export BUNDLE_GEMFILE=gemfiles/
|
66
|
+
export BUNDLE_GEMFILE=gemfiles/rails_61/Gemfile
|
67
67
|
```
|
68
68
|
|
69
69
|
**Warning** SCSS assets are aimed to be used indifferently with Sprockets **and** webpacker.
|
data/docs/0-installation.md
CHANGED
@@ -114,7 +114,7 @@ If you're getting the error `wrong number of arguments (6 for 4..5)`, [read #270
|
|
114
114
|
|
115
115
|
## webpacker
|
116
116
|
|
117
|
-
|
117
|
+
You can **opt-in to using Webpacker for ActiveAdmin assets** as well by updating your configuration to turn on the `use_webpacker` option, either at installation time or manually.
|
118
118
|
|
119
119
|
* at active_admin installation:
|
120
120
|
|
data/docs/5-forms.md
CHANGED
data/docs/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (6.0.4.
|
4
|
+
activesupport (6.0.4.7)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
6
|
i18n (>= 0.7, < 2)
|
7
7
|
minitest (~> 5.1)
|
@@ -15,7 +15,7 @@ GEM
|
|
15
15
|
coffee-script-source (1.11.1)
|
16
16
|
colorator (1.1.0)
|
17
17
|
commonmarker (0.23.4)
|
18
|
-
concurrent-ruby (1.1.
|
18
|
+
concurrent-ruby (1.1.10)
|
19
19
|
dnsruby (1.61.9)
|
20
20
|
simpleidn (~> 0.1)
|
21
21
|
em-websocket (0.5.3)
|
@@ -51,9 +51,9 @@ GEM
|
|
51
51
|
ffi (1.15.5)
|
52
52
|
forwardable-extended (2.6.0)
|
53
53
|
gemoji (3.0.1)
|
54
|
-
github-pages (
|
54
|
+
github-pages (226)
|
55
55
|
github-pages-health-check (= 1.17.9)
|
56
|
-
jekyll (= 3.9.
|
56
|
+
jekyll (= 3.9.2)
|
57
57
|
jekyll-avatar (= 0.7.0)
|
58
58
|
jekyll-coffeescript (= 1.1.1)
|
59
59
|
jekyll-commonmark-ghpages (= 0.2.0)
|
@@ -88,12 +88,12 @@ GEM
|
|
88
88
|
jekyll-theme-time-machine (= 0.2.0)
|
89
89
|
jekyll-titles-from-headings (= 0.5.3)
|
90
90
|
jemoji (= 0.12.0)
|
91
|
-
kramdown (= 2.3.
|
91
|
+
kramdown (= 2.3.2)
|
92
92
|
kramdown-parser-gfm (= 1.1.0)
|
93
93
|
liquid (= 4.0.3)
|
94
94
|
mercenary (~> 0.3)
|
95
95
|
minima (= 2.5.1)
|
96
|
-
nokogiri (>= 1.
|
96
|
+
nokogiri (>= 1.13.4, < 2.0)
|
97
97
|
rouge (= 3.26.0)
|
98
98
|
terminal-table (~> 1.4)
|
99
99
|
github-pages-health-check (1.17.9)
|
@@ -102,13 +102,13 @@ GEM
|
|
102
102
|
octokit (~> 4.0)
|
103
103
|
public_suffix (>= 3.0, < 5.0)
|
104
104
|
typhoeus (~> 1.3)
|
105
|
-
html-pipeline (2.14.
|
105
|
+
html-pipeline (2.14.1)
|
106
106
|
activesupport (>= 2)
|
107
107
|
nokogiri (>= 1.4)
|
108
108
|
http_parser.rb (0.8.0)
|
109
109
|
i18n (0.9.5)
|
110
110
|
concurrent-ruby (~> 1.0)
|
111
|
-
jekyll (3.9.
|
111
|
+
jekyll (3.9.2)
|
112
112
|
addressable (~> 2.4)
|
113
113
|
colorator (~> 1.0)
|
114
114
|
em-websocket (~> 0.5)
|
@@ -216,7 +216,7 @@ GEM
|
|
216
216
|
gemoji (~> 3.0)
|
217
217
|
html-pipeline (~> 2.2)
|
218
218
|
jekyll (>= 3.0, < 5.0)
|
219
|
-
kramdown (2.3.
|
219
|
+
kramdown (2.3.2)
|
220
220
|
rexml
|
221
221
|
kramdown-parser-gfm (1.1.0)
|
222
222
|
kramdown (~> 2.0)
|
@@ -232,7 +232,7 @@ GEM
|
|
232
232
|
jekyll-seo-tag (~> 2.1)
|
233
233
|
minitest (5.15.0)
|
234
234
|
multipart-post (2.1.1)
|
235
|
-
nokogiri (1.13.
|
235
|
+
nokogiri (1.13.6)
|
236
236
|
mini_portile2 (~> 2.8.0)
|
237
237
|
racc (~> 1.4)
|
238
238
|
octokit (4.22.0)
|
@@ -240,7 +240,7 @@ GEM
|
|
240
240
|
sawyer (~> 0.8.0, >= 0.5.3)
|
241
241
|
pathutil (0.16.2)
|
242
242
|
forwardable-extended (~> 2.6)
|
243
|
-
public_suffix (4.0.
|
243
|
+
public_suffix (4.0.7)
|
244
244
|
racc (1.6.0)
|
245
245
|
rb-fsevent (0.11.1)
|
246
246
|
rb-inotify (0.10.1)
|
@@ -269,7 +269,7 @@ GEM
|
|
269
269
|
thread_safe (~> 0.1)
|
270
270
|
unf (0.1.4)
|
271
271
|
unf_ext
|
272
|
-
unf_ext (0.0.8)
|
272
|
+
unf_ext (0.0.8.1)
|
273
273
|
unicode-display_width (1.8.0)
|
274
274
|
zeitwerk (2.5.4)
|
275
275
|
|
@@ -76,7 +76,7 @@ module ActiveAdmin
|
|
76
76
|
|
77
77
|
namespace = namespaces[name.to_sym] ||= begin
|
78
78
|
namespace = Namespace.new(self, name)
|
79
|
-
ActiveSupport::Notifications.instrument ActiveAdmin::Namespace::RegisterEvent, namespace
|
79
|
+
ActiveSupport::Notifications.instrument ActiveAdmin::Namespace::RegisterEvent, { active_admin_namespace: namespace }
|
80
80
|
namespace
|
81
81
|
end
|
82
82
|
|
@@ -112,10 +112,10 @@ module ActiveAdmin
|
|
112
112
|
# To reload everything simply call `ActiveAdmin.unload!`
|
113
113
|
def load!
|
114
114
|
unless loaded?
|
115
|
-
ActiveSupport::Notifications.instrument BeforeLoadEvent, self # before_load hook
|
115
|
+
ActiveSupport::Notifications.instrument BeforeLoadEvent, { active_admin_application: self } # before_load hook
|
116
116
|
files.each { |file| load file } # load files
|
117
117
|
namespace(default_namespace) # init AA resources
|
118
|
-
ActiveSupport::Notifications.instrument AfterLoadEvent, self # after_load hook
|
118
|
+
ActiveSupport::Notifications.instrument AfterLoadEvent, { active_admin_application: self } # after_load hook
|
119
119
|
@@loaded = true
|
120
120
|
end
|
121
121
|
end
|
@@ -126,7 +126,7 @@ module ActiveAdmin
|
|
126
126
|
|
127
127
|
# Returns ALL the files to be loaded
|
128
128
|
def files
|
129
|
-
load_paths.flatten.compact.uniq.flat_map { |path| Dir["#{path}/**/*.rb"] }
|
129
|
+
load_paths.flatten.compact.uniq.flat_map { |path| Dir["#{path}/**/*.rb"].sort }
|
130
130
|
end
|
131
131
|
|
132
132
|
# Creates all the necessary routes for the ActiveAdmin configurations
|
@@ -43,7 +43,6 @@ module ActiveAdmin
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def build(controller, csv)
|
46
|
-
@collection = controller.send :find_collection, except: :pagination
|
47
46
|
columns = exec_columns controller.view_context
|
48
47
|
bom = options[:byte_order_mark]
|
49
48
|
column_names = options.delete(:column_names) { true }
|
@@ -55,13 +54,8 @@ module ActiveAdmin
|
|
55
54
|
csv << CSV.generate_line(columns.map { |c| encode c.name, options }, **csv_options)
|
56
55
|
end
|
57
56
|
|
58
|
-
|
59
|
-
(
|
60
|
-
paginated_collection(page).each do |resource|
|
61
|
-
resource = controller.send :apply_decorator, resource
|
62
|
-
csv << CSV.generate_line(build_row(resource, columns, options), **csv_options)
|
63
|
-
end
|
64
|
-
end
|
57
|
+
controller.send(:in_paginated_batches) do |resource|
|
58
|
+
csv << CSV.generate_line(build_row(resource, columns, options), **csv_options)
|
65
59
|
end
|
66
60
|
|
67
61
|
csv
|
@@ -125,13 +119,5 @@ module ActiveAdmin
|
|
125
119
|
def column_transitive_options
|
126
120
|
@column_transitive_options ||= @options.slice(*COLUMN_TRANSITIVE_OPTIONS)
|
127
121
|
end
|
128
|
-
|
129
|
-
def paginated_collection(page_no = 1)
|
130
|
-
@collection.public_send(Kaminari.config.page_method_name, page_no).per(batch_size)
|
131
|
-
end
|
132
|
-
|
133
|
-
def batch_size
|
134
|
-
1000
|
135
|
-
end
|
136
122
|
end
|
137
123
|
end
|
@@ -60,7 +60,7 @@ module ActiveAdmin
|
|
60
60
|
settings.respond_to?(method) ? settings.send(method, *args) : super
|
61
61
|
end
|
62
62
|
|
63
|
-
# Register a resource into this namespace. The
|
63
|
+
# Register a resource into this namespace. The preferred method to access this is to
|
64
64
|
# use the global registration ActiveAdmin.register which delegates to the proper
|
65
65
|
# namespace instance.
|
66
66
|
def register(resource_class, options = {}, &block)
|
@@ -72,7 +72,7 @@ module ActiveAdmin
|
|
72
72
|
reset_menu!
|
73
73
|
|
74
74
|
# Dispatch a registration event
|
75
|
-
ActiveSupport::Notifications.instrument ActiveAdmin::Resource::RegisterEvent, config
|
75
|
+
ActiveSupport::Notifications.instrument ActiveAdmin::Resource::RegisterEvent, { active_admin_resource: config }
|
76
76
|
|
77
77
|
# Return the config
|
78
78
|
config
|
@@ -31,16 +31,13 @@ module ActiveAdmin
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def retrieve_policy(subject)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
rescue Pundit::NotDefinedError => e
|
40
|
-
if default_policy_class
|
41
|
-
default_policy(user, subject)
|
34
|
+
target = policy_target(subject)
|
35
|
+
if (policy = policy(namespace(target)) || compat_policy(subject))
|
36
|
+
policy
|
37
|
+
elsif default_policy_class
|
38
|
+
default_policy(subject)
|
42
39
|
else
|
43
|
-
raise
|
40
|
+
raise Pundit::NotDefinedError, "unable to find a compatible policy for `#{target}`"
|
44
41
|
end
|
45
42
|
end
|
46
43
|
|
@@ -57,8 +54,42 @@ module ActiveAdmin
|
|
57
54
|
|
58
55
|
private
|
59
56
|
|
57
|
+
def policy_target(subject)
|
58
|
+
case subject
|
59
|
+
when nil then resource
|
60
|
+
when Class then subject.new
|
61
|
+
else subject
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# This method is needed to fallback to our previous policy searching logic.
|
66
|
+
# I.e.: when class name contains `default_policy_namespace` (eg: ShopAdmin)
|
67
|
+
# we should try to search it without namespace. This is because that's
|
68
|
+
# the only thing that worked in this case before we fixed our buggy namespace
|
69
|
+
# detection, so people are probably relying on it.
|
70
|
+
# This fallback might be removed in future versions of ActiveAdmin, so
|
71
|
+
# pundit_adapter search will work consistently with provided namespaces
|
72
|
+
def compat_policy(subject)
|
73
|
+
return unless default_policy_namespace
|
74
|
+
|
75
|
+
target = policy_target(subject)
|
76
|
+
|
77
|
+
return unless target.class.to_s.include?(default_policy_module) &&
|
78
|
+
(policy = policy(target))
|
79
|
+
|
80
|
+
policy_name = policy.class.to_s
|
81
|
+
|
82
|
+
Deprecation.warn "You have `pundit_policy_namespace` configured as `#{default_policy_namespace}`, " \
|
83
|
+
"but ActiveAdmin was unable to find policy #{default_policy_module}::#{policy_name}. " \
|
84
|
+
"#{policy_name} will be used instead. " \
|
85
|
+
"This behavior will be removed in future versions of ActiveAdmin. " \
|
86
|
+
"To fix this warning, move your #{policy_name} policy to the #{default_policy_module} namespace"
|
87
|
+
|
88
|
+
policy
|
89
|
+
end
|
90
|
+
|
60
91
|
def namespace(object)
|
61
|
-
if default_policy_namespace && !object.class.to_s.
|
92
|
+
if default_policy_namespace && !object.class.to_s.start_with?("#{default_policy_module}::")
|
62
93
|
[default_policy_namespace.to_sym, object]
|
63
94
|
else
|
64
95
|
object
|
@@ -69,7 +100,7 @@ module ActiveAdmin
|
|
69
100
|
ActiveAdmin.application.pundit_default_policy && ActiveAdmin.application.pundit_default_policy.constantize
|
70
101
|
end
|
71
102
|
|
72
|
-
def default_policy(
|
103
|
+
def default_policy(subject)
|
73
104
|
default_policy_class.new(user, subject)
|
74
105
|
end
|
75
106
|
|
@@ -77,6 +108,18 @@ module ActiveAdmin
|
|
77
108
|
ActiveAdmin.application.pundit_policy_namespace
|
78
109
|
end
|
79
110
|
|
111
|
+
def default_policy_module
|
112
|
+
default_policy_namespace.to_s.camelize
|
113
|
+
end
|
114
|
+
|
115
|
+
def policy(target)
|
116
|
+
policies[target] ||= Pundit.policy(user, target)
|
117
|
+
end
|
118
|
+
|
119
|
+
def policies
|
120
|
+
@policies ||= {}
|
121
|
+
end
|
122
|
+
|
80
123
|
end
|
81
124
|
|
82
125
|
end
|
@@ -250,12 +250,13 @@ module ActiveAdmin
|
|
250
250
|
end
|
251
251
|
|
252
252
|
def apply_pagination(chain)
|
253
|
+
# skip pagination if CSV format was requested
|
254
|
+
return chain if params["format"] == "csv"
|
253
255
|
# skip pagination if already was paginated by scope
|
254
256
|
return chain if chain.respond_to?(:total_pages)
|
255
|
-
page_method_name = Kaminari.config.page_method_name
|
256
257
|
page = params[Kaminari.config.param_name]
|
257
258
|
|
258
|
-
chain
|
259
|
+
paginate(chain, page, per_page)
|
259
260
|
end
|
260
261
|
|
261
262
|
def collection_applies(options = {})
|
@@ -265,6 +266,16 @@ module ActiveAdmin
|
|
265
266
|
COLLECTION_APPLIES & only - except
|
266
267
|
end
|
267
268
|
|
269
|
+
def in_paginated_batches(&block)
|
270
|
+
ActiveRecord::Base.uncached do
|
271
|
+
(1..paginated_collection.total_pages).each do |page|
|
272
|
+
paginated_collection(page).each do |resource|
|
273
|
+
yield apply_decorator(resource)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
268
279
|
def per_page
|
269
280
|
if active_admin_config.paginate
|
270
281
|
dynamic_per_page || configured_per_page
|
@@ -318,6 +329,20 @@ module ActiveAdmin
|
|
318
329
|
def create_another?
|
319
330
|
params[:create_another].present?
|
320
331
|
end
|
332
|
+
|
333
|
+
def paginated_collection(page_no = 1)
|
334
|
+
paginate(collection, page_no, batch_size)
|
335
|
+
end
|
336
|
+
|
337
|
+
def paginate(chain, page, per_page)
|
338
|
+
page_method_name = Kaminari.config.page_method_name
|
339
|
+
|
340
|
+
chain.public_send(page_method_name, page).per(per_page)
|
341
|
+
end
|
342
|
+
|
343
|
+
def batch_size
|
344
|
+
1000
|
345
|
+
end
|
321
346
|
end
|
322
347
|
end
|
323
348
|
end
|
data/lib/active_admin/version.rb
CHANGED
data/lib/active_admin.rb
CHANGED
@@ -113,7 +113,7 @@ module ActiveAdmin
|
|
113
113
|
private
|
114
114
|
|
115
115
|
def wrap_block_for_active_support_notifications block
|
116
|
-
proc { |_name, _start, _finish, _id, payload| block.call payload }
|
116
|
+
proc { |_name, _start, _finish, _id, payload| block.call payload[:active_admin_application] }
|
117
117
|
end
|
118
118
|
|
119
119
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Maresh
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2022-
|
18
|
+
date: 2022-05-20 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: arbre
|
@@ -125,7 +125,7 @@ dependencies:
|
|
125
125
|
requirements:
|
126
126
|
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: '6.
|
128
|
+
version: '6.1'
|
129
129
|
- - "<"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '7.1'
|
@@ -135,7 +135,7 @@ dependencies:
|
|
135
135
|
requirements:
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '6.
|
138
|
+
version: '6.1'
|
139
139
|
- - "<"
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '7.1'
|
@@ -143,22 +143,22 @@ dependencies:
|
|
143
143
|
name: ransack
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
145
145
|
requirements:
|
146
|
-
- - "~>"
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
version: '2.1'
|
149
146
|
- - ">="
|
150
147
|
- !ruby/object:Gem::Version
|
151
148
|
version: 2.1.1
|
149
|
+
- - "<"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '4'
|
152
152
|
type: :runtime
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
|
-
- - "~>"
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '2.1'
|
159
156
|
- - ">="
|
160
157
|
- !ruby/object:Gem::Version
|
161
158
|
version: 2.1.1
|
159
|
+
- - "<"
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '4'
|
162
162
|
description: The administration framework for Ruby on Rails.
|
163
163
|
email:
|
164
164
|
- deivid.rodriguez@riseup.net
|
@@ -578,7 +578,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
578
578
|
- !ruby/object:Gem::Version
|
579
579
|
version: '0'
|
580
580
|
requirements: []
|
581
|
-
rubygems_version: 3.3.
|
581
|
+
rubygems_version: 3.3.7
|
582
582
|
signing_key:
|
583
583
|
specification_version: 4
|
584
584
|
summary: Active Admin is a Ruby on Rails plugin for generating administration style
|