pundit-plus 0.1.2 → 0.1.3

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: ce22ded18b7ecf472d8fa7f35e15e5a6653a57d5222cc28d88326da396470f1e
4
- data.tar.gz: ecf9b251f941b71687937a9acf5e63b7459ad8919271213a3402b98b2606b94f
3
+ metadata.gz: 7294e31ee669a032370e6f11411e14a21e35b0042cc17dcc4d12d95cff0100f0
4
+ data.tar.gz: '089db28a172510cb271460ef16b98593d30d963faafcd3df4284fa64010a35c3'
5
5
  SHA512:
6
- metadata.gz: e5836505f3537b4d8399c09933edab89ab3ce0730816c3d7f38aad5003399d587ab4d600ce187ed218b99386345d1f7fe4d4c16c190b16475e69030b754568db
7
- data.tar.gz: 8f022172f750e43af4724da0a480324c946a0ed90ed8cab0d0547132b01ea76ab14803a6027d53faa3740455f0308617ea8f35be06db47b51c4cee850e7e6fee
6
+ metadata.gz: 8a96685a1f150ec143f6b074e3972ae4c24b557475f069293f8f47d5508133ba1f71a8aaca0974fb478a410637aae80e781b5c3deeabcda7156db730f6b46bb8
7
+ data.tar.gz: f46cd13c2bcad4649aaaef72982f24f0196a7b8110f8c81452a68a20395a049e7b5a8c08f75ebd11ba1c58b33ceaa920ad87d3ba95081c1e8f9201a4b122563c
data/CHANGELOG.md CHANGED
@@ -2,17 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.3] - 2024-10-23
6
+
7
+ ### Added
8
+
9
+ - Added support for Pundit::Context
10
+ - Using reissue for changelog and release management
11
+
5
12
  ## [0.1.2] - 2024-04-10
6
13
 
7
14
  ### Added
15
+
8
16
  - Fixed the missing changelog information for the previous version.
9
17
 
10
18
  ## [0.1.1] - 2024-04-10
11
19
 
12
20
  ### Added
21
+
13
22
  - Added params_for_action support in controller Authorization
14
23
 
15
24
  ## [0.1.0] - 2024-04-10
16
25
 
17
26
  ### Added
18
- - Initial project setup with basic Pundit integration.
27
+
28
+ - Initial project setup with basic Pundit integration.
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Add some extra features to Pundit.
4
4
 
5
+ - Custom exceptions
6
+ - Manage required or permitted params from within your policy classes
7
+
5
8
  ## Installation
6
9
 
7
10
  Install the gem and add to the application's Gemfile by executing:
@@ -49,11 +52,21 @@ class MyPolicy < ApplicationPolicy
49
52
  end
50
53
 
51
54
  # Return the params for the action but require a special key
52
- def params_for_create(params)
53
- params_for(@record, params, :create).tap do |params|
55
+ def params_for_update(params)
56
+ params_for(@record, params, :update).tap do |params|
54
57
  params.require(:special_key)
55
58
  end
56
59
  end
60
+
61
+ def permitted_attributes
62
+ %i[name other special_key]
63
+ end
64
+ end
65
+
66
+ class SomeController < ApplicationController
67
+ def update
68
+ @some_record.update(params_for_action(@some_record))
69
+ end
57
70
  end
58
71
  ```
59
72
 
data/Rakefile CHANGED
@@ -6,3 +6,9 @@ require "rspec/core/rake_task"
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
8
  task default: :spec
9
+
10
+ require "reissue/gem"
11
+
12
+ Reissue::Task.create do |task|
13
+ task.version_file = "lib/pundit/plus/version.rb"
14
+ end
@@ -21,4 +21,9 @@ module Pundit
21
21
  end
22
22
  end
23
23
  end
24
- Pundit.singleton_class.prepend(Pundit::Plus::CustomException)
24
+
25
+ if Pundit.const_defined?(:Context)
26
+ Pundit::Context.prepend(Pundit::Plus::CustomException)
27
+ else
28
+ Pundit.singleton_class.prepend(Pundit::Plus::CustomException)
29
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Pundit
4
4
  module Plus
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
data/lib/pundit/plus.rb CHANGED
@@ -24,7 +24,7 @@ module Pundit
24
24
  "permitted_attributes"
25
25
  end
26
26
 
27
- required = params.require(
27
+ params.require(
28
28
  PolicyFinder.new(record).param_key
29
29
  ).permit(
30
30
  *send(param_method)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pundit-plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-11 00:00:00.000000000 Z
11
+ date: 2024-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pundit
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.5.5
78
+ rubygems_version: 3.5.9
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Pundit with additional features.