action_policy 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 322dfe78ddec91cb0d7c46b290f69484ba2fdf417c85c687d23e6b521db3e097
4
- data.tar.gz: b263d5a7000f202b480331e4dd486726563ab83a4828bd57dbaa8c2e8a3b86a3
3
+ metadata.gz: dd9504fed879c71d0ebb7025a8bf8ced503b3ed6dfd2d41b1585db47ca2d5548
4
+ data.tar.gz: 0c494eaae0d4283a604494af6f3e61326a21402e9ef98321840e755b585a0273
5
5
  SHA512:
6
- metadata.gz: 93628bb047eb417395cc9b7f0b15f2f97882d327c32212105d186ef42187fc24e84abd37bdf40968ae5a5988d318d717f0fb3af454f5fb14059a3dc84fe98c08
7
- data.tar.gz: 9d0387f6aea496ac9d3affdb6cfe89b9fef008d9ff2f96a97a69ce19c0832f8fe01d2023f4497a150325e00e341d6a170b8218e3ce47e06a96d8de28aea38cb5
6
+ metadata.gz: acdb59593707dc6f0f28b6f3c75f770386a1db35662eea95ae1eb0932fc1900e8a384c10c4e88eb70e3fde853e88414e3442f4994c59a364f94e50efb6c97cf7
7
+ data.tar.gz: a2deccf57e2c97b5c3dae5730ae7deecf487b49bb08cfcf488034ad3ff94e80495f3d76ad4553d76cf3f7b8f1322157c3c8f9b45179779af14212a4c9d18ce51
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.7.7 (2026-09-03)
6
+
7
+ - Fix caching non-persistent Active Record objects as the same entry ([@palkan][])
8
+
9
+ - Fix initializer racing condition with Rails 8.1 ([@inkstak][])
10
+
5
11
  ## 0.7.6 (2025-01-13)
6
12
 
7
13
  - Execute proc passed to the `:through` option of `authorize` against `self` ([@Pagehey][])
data/README.md CHANGED
@@ -15,8 +15,9 @@ Composable. Extensible. Performant.
15
15
 
16
16
  📑 [Documentation](https://actionpolicy.evilmartians.io)
17
17
 
18
- <a href="https://evilmartians.com/?utm_source=action_policy">
19
- <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
18
+ <br/>
19
+
20
+ <img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="Evil Martians logo" width="22" height="16" /> <b>Action Policy</b> is built by <b><a href="https://evilmartians.com/">Evil Martians</a></b>, an American design and engineering consultancy for <b>developer tools, AI, and cybersecurity startups</b>.
20
21
 
21
22
  ## Resources
22
23
 
@@ -118,7 +119,7 @@ Read more in our [Documentation][].
118
119
 
119
120
  There are [many authorization libraries](https://www.ruby-toolbox.com/categories/rails_authorization) for Ruby/Rails applications.
120
121
 
121
- What makes Action Policy different? See [this section](https://actionpolicy.evilmartians.io/#/?id=what-about-the-existing-solutions) in our docs.
122
+ What makes Action Policy different? See [this section](https://actionpolicy.evilmartians.io/guide/#what-about-the-existing-solutions) in our docs.
122
123
 
123
124
  ## Contributing
124
125
 
@@ -65,7 +65,7 @@ module ActionPolicy
65
65
  private def build_authorization_context
66
66
  self.class.authorization_targets
67
67
  .each_with_object({}) do |(key, method_or_proc), obj|
68
- obj[key] = method_or_proc.is_a?(Proc) ? instance_exec(&method_or_proc) : send(method_or_proc)
68
+ obj[key] = method_or_proc.is_a?(Proc) ? instance_exec(&method_or_proc) : send(method_or_proc)
69
69
  end
70
70
  end
71
71
 
@@ -15,3 +15,14 @@ ActiveRecord::Relation.include(Module.new do
15
15
  nil
16
16
  end
17
17
  end)
18
+
19
+ # Ensure non-persistent models are not cached as a single entry
20
+ ActiveRecord::Base.include(Module.new do
21
+ def policy_cache_key
22
+ if persisted?
23
+ cache_key_with_version
24
+ else
25
+ object_id.to_s
26
+ end
27
+ end
28
+ end)
@@ -61,7 +61,7 @@ module ActionPolicy # :nodoc:
61
61
  app.executor.to_complete { ActionPolicy::PerThreadCache.clear_all }
62
62
  end
63
63
 
64
- initializer "action_policy.extensions" do |app|
64
+ initializer "action_policy.extensions", after: :load_config_initializers do |app|
65
65
  if app.config.action_policy.instrumentation_enabled
66
66
  require "action_policy/rails/policy/instrumentation"
67
67
  require "action_policy/rails/authorizer"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionPolicy
4
- VERSION = "0.7.6"
4
+ VERSION = "0.7.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_policy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev