activeadmin 2.12.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fee30bf6175502c7e29f5cba45777a52fd9d72f9433f7f3911ba324a24638ef
4
- data.tar.gz: 8ad44b1980960d2e8abb3f1406f90c3a0cd01255f0fcb30b6a56bf3cb8db1ab6
3
+ metadata.gz: 0b3beb756b607b196f72d4ec4a4b173867021bb2eba03d183797165810a526b5
4
+ data.tar.gz: bed4421fc6a28f2ff0bee9659a76bfd680b9432c74d290753c62392c3a7048d3
5
5
  SHA512:
6
- metadata.gz: 39beb44c14375cec330f99a1d63d38959523a0bbbcf90e55f6b938a71a8d2624b9f8fdb110839b7272b346acdd533bc3f0fcd3a78ca3c3250bf401c807fb4b13
7
- data.tar.gz: 9b4d5fb6d6d2238925e315c639bb6625703102d111c482399eb79b02cd6f203f7145770c2985795c2a3f60f6822f2757efe1e5c57a8c4ede3716e023e2efc50e
6
+ metadata.gz: 11cce1d23fb4519f394ef13930716fabe39e6d7654f5c4424c887fe54e6d56225700155ae59187ad42a6551d9bcf17f95652c08d234ddafb5ba2d4fb5e444a09
7
+ data.tar.gz: 452592e57f8fe9f16e683a2f54b9dc7fdd717d1ec2db909710a07cfb74dda5d8f7a0efda515b439555470381da020e75b2d4dfe328a8b52bc436b2f94371525b
data/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
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
+
5
26
  ## 2.12.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.11.2..v2.12.0)
6
27
 
7
28
  ### Enhancements
@@ -772,6 +793,11 @@ Please check [0-6-stable] for previous changes.
772
793
  [#7384]: https://github.com/activeadmin/activeadmin/pull/7384
773
794
  [#7394]: https://github.com/activeadmin/activeadmin/pull/7394
774
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
775
801
 
776
802
  [@1000ship]: https://github.com/1000ship
777
803
  [@5t111111]: https://github.com/5t111111
@@ -782,6 +808,7 @@ Please check [0-6-stable] for previous changes.
782
808
  [@alejandroperea]: https://github.com/alejandroperea
783
809
  [@alex-bogomolov]: https://github.com/alex-bogomolov
784
810
  [@amiel]: https://github.com/amiel
811
+ [@amit]: https://github.com/amit
785
812
  [@amiuhle]: https://github.com/amiuhle
786
813
  [@andreslemik]: https://github.com/andreslemik
787
814
  [@bartoszkopinski]: https://github.com/bartoszkopinski
@@ -818,6 +845,7 @@ Please check [0-6-stable] for previous changes.
818
845
  [@innparusu95]: https://github.com/innparusu95
819
846
  [@ionut998]: https://github.com/ionut998
820
847
  [@irmela]: https://github.com/irmela
848
+ [@ispyropoulos]: https://github.com/ispyropoulos
821
849
  [@Ivanov-Anton]: https://github.com/Ivanov-Anton
822
850
  [@jasl]: https://github.com/jasl
823
851
  [@javawizard]: https://github.com/javawizard
@@ -876,6 +904,7 @@ Please check [0-6-stable] for previous changes.
876
904
  [@stereoscott]: https://github.com/stereoscott
877
905
  [@tagliala]: https://github.com/tagliala
878
906
  [@taralbass]: https://github.com/taralbass
907
+ [@tf]: https://github.com/tf
879
908
  [@tiagotex]: https://github.com/tiagotex
880
909
  [@timoschilling]: https://github.com/timoschilling
881
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/rails_60/Gemfile
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/5-forms.md CHANGED
@@ -182,7 +182,8 @@ To display a list of all validation errors:
182
182
 
183
183
  ```ruby
184
184
  form do |f|
185
- f.semantic_errors *f.object.errors.keys
185
+ f.semantic_errors *f.object.errors.attribute_names
186
+
186
187
  # ...
187
188
  end
188
189
  ```
data/docs/Gemfile.lock CHANGED
@@ -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.4)
235
+ nokogiri (1.13.6)
236
236
  mini_portile2 (~> 2.8.0)
237
237
  racc (~> 1.4)
238
238
  octokit (4.22.0)
@@ -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"] }.sort
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
@@ -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 preffered method to access this is to
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,14 +31,13 @@ module ActiveAdmin
31
31
  end
32
32
 
33
33
  def retrieve_policy(subject)
34
- Pundit.policy!(user, namespace(policy_target(subject)))
35
- rescue Pundit::NotDefinedError => e
36
- if (policy = compat_policy(subject))
34
+ target = policy_target(subject)
35
+ if (policy = policy(namespace(target)) || compat_policy(subject))
37
36
  policy
38
37
  elsif default_policy_class
39
- default_policy(user, subject)
38
+ default_policy(subject)
40
39
  else
41
- raise e
40
+ raise Pundit::NotDefinedError, "unable to find a compatible policy for `#{target}`"
42
41
  end
43
42
  end
44
43
 
@@ -71,11 +70,12 @@ module ActiveAdmin
71
70
  # This fallback might be removed in future versions of ActiveAdmin, so
72
71
  # pundit_adapter search will work consistently with provided namespaces
73
72
  def compat_policy(subject)
73
+ return unless default_policy_namespace
74
+
74
75
  target = policy_target(subject)
75
76
 
76
- return unless default_policy_namespace &&
77
- target.class.to_s.include?(default_policy_module) &&
78
- (policy = Pundit.policy(user, target))
77
+ return unless target.class.to_s.include?(default_policy_module) &&
78
+ (policy = policy(target))
79
79
 
80
80
  policy_name = policy.class.to_s
81
81
 
@@ -89,7 +89,7 @@ module ActiveAdmin
89
89
  end
90
90
 
91
91
  def namespace(object)
92
- if default_policy_namespace && !object.class.to_s.match?(/^#{default_policy_module}::/)
92
+ if default_policy_namespace && !object.class.to_s.start_with?("#{default_policy_module}::")
93
93
  [default_policy_namespace.to_sym, object]
94
94
  else
95
95
  object
@@ -100,7 +100,7 @@ module ActiveAdmin
100
100
  ActiveAdmin.application.pundit_default_policy && ActiveAdmin.application.pundit_default_policy.constantize
101
101
  end
102
102
 
103
- def default_policy(user, subject)
103
+ def default_policy(subject)
104
104
  default_policy_class.new(user, subject)
105
105
  end
106
106
 
@@ -112,6 +112,14 @@ module ActiveAdmin
112
112
  default_policy_namespace.to_s.camelize
113
113
  end
114
114
 
115
+ def policy(target)
116
+ policies[target] ||= Pundit.policy(user, target)
117
+ end
118
+
119
+ def policies
120
+ @policies ||= {}
121
+ end
122
+
115
123
  end
116
124
 
117
125
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ActiveAdmin
3
- VERSION = "2.12.0"
3
+ VERSION = "2.13.1"
4
4
  end
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.12.0
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-04-22 00:00:00.000000000 Z
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.0'
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.0'
138
+ version: '6.1'
139
139
  - - "<"
140
140
  - !ruby/object:Gem::Version
141
141
  version: '7.1'
@@ -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.10
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