activeadmin 2.12.0 → 2.13.0

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: 170a59df9471df04e568a2ae1cc4dab8ff58c28fd28a6861a5e87ba596a4e913
4
+ data.tar.gz: ff345b66e5c18bc94b2a9394d0a633ebe12cce3f7c94b5119ece2b54bcf86836
5
5
  SHA512:
6
- metadata.gz: 39beb44c14375cec330f99a1d63d38959523a0bbbcf90e55f6b938a71a8d2624b9f8fdb110839b7272b346acdd533bc3f0fcd3a78ca3c3250bf401c807fb4b13
7
- data.tar.gz: 9b4d5fb6d6d2238925e315c639bb6625703102d111c482399eb79b02cd6f203f7145770c2985795c2a3f60f6822f2757efe1e5c57a8c4ede3716e023e2efc50e
6
+ metadata.gz: 558b34213e3a1af076814008a337ed3d7a66fa328c33bb460020f28595f4e4898e815752dde54c8b41ab6fa687989e7c4d0d8cd58113e736bdafe3943b3c3026
7
+ data.tar.gz: bb0f39fecd17ef5bb0063aaa64cf2ee2684fa52b19faf7b2e37fc273484554ad97a686972f5d5baa02cbd8d785efd9de384769e86b2083f5a2a6c591381d573d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.13.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.12.0..v2.13.0)
6
+
7
+ ### Documentation
8
+
9
+ * Update validation errors documentation to account for deprecated `ActiveModel::Errors#keys`. [#7475] by [@amit]
10
+
11
+ ### Dependency Changes
12
+
13
+ * Drop rails 6.0 support. [#7476] by [@deivid-rodriguez]
14
+
15
+ ### Performance
16
+
17
+ * Fix pundit performance. [#7479] by [@deivid-rodriguez]
18
+
5
19
  ## 2.12.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.11.2..v2.12.0)
6
20
 
7
21
  ### Enhancements
@@ -772,6 +786,9 @@ Please check [0-6-stable] for previous changes.
772
786
  [#7384]: https://github.com/activeadmin/activeadmin/pull/7384
773
787
  [#7394]: https://github.com/activeadmin/activeadmin/pull/7394
774
788
  [#7453]: https://github.com/activeadmin/activeadmin/pull/7453
789
+ [#7475]: https://github.com/activeadmin/activeadmin/pull/7475
790
+ [#7476]: https://github.com/activeadmin/activeadmin/pull/7476
791
+ [#7479]: https://github.com/activeadmin/activeadmin/pull/7479
775
792
 
776
793
  [@1000ship]: https://github.com/1000ship
777
794
  [@5t111111]: https://github.com/5t111111
@@ -782,6 +799,7 @@ Please check [0-6-stable] for previous changes.
782
799
  [@alejandroperea]: https://github.com/alejandroperea
783
800
  [@alex-bogomolov]: https://github.com/alex-bogomolov
784
801
  [@amiel]: https://github.com/amiel
802
+ [@amit]: https://github.com/amit
785
803
  [@amiuhle]: https://github.com/amiuhle
786
804
  [@andreslemik]: https://github.com/andreslemik
787
805
  [@bartoszkopinski]: https://github.com/bartoszkopinski
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
  ```
@@ -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.0"
4
4
  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.0
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-07 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.13
582
582
  signing_key:
583
583
  specification_version: 4
584
584
  summary: Active Admin is a Ruby on Rails plugin for generating administration style