crewd_policies 0.3.2 → 0.3.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
  SHA1:
3
- metadata.gz: 79f754752bc6dec904e86214c84ce3cc367ef819
4
- data.tar.gz: 500277df978ea184d161151b29d8bf18b788cf1f
3
+ metadata.gz: c1faadaf0ead8b222055bd12352c9a9e60b37b1c
4
+ data.tar.gz: 32d9daabec143d2762d0c94d465190f1c68e9820
5
5
  SHA512:
6
- metadata.gz: 050307ed65d1ee99dbd65f11491c871c786a489b4643e7ad45155c0fdfb49fca1c2f079d746fe5503dbea345da951828ce04129e0d5d29b5bae4bee914b8e9b4
7
- data.tar.gz: ad33e8f4cb4455a459c1b06f034203f29623de04eb8bf5e7a1188d4b5efb4c2a14f7ed8eeab2ce4275a4a1839240960d5c489ceac5650f53b46ad5a6607df679
6
+ metadata.gz: 3747e925434b48677568789ed8c4275863d2f7e88d2ad11f967a93db2295d1dcd538bf8a96f8bb8fd0723690a1f6eaa4cd04e56a59b5308882f5035315ec5347
7
+ data.tar.gz: bdb2da59bb045ff010ea957b174fd6d840c252983ebb689ca5dc9c173a27a06707761da45e44ff6c0fea34156c20a12d4fb5cd19d84b6c150030ff7a64074e19
@@ -24,11 +24,13 @@ module CrewdPolicies
24
24
  end
25
25
 
26
26
  def updatable_fields(context)
27
- ::Pundit.policy!(context[:user],_model).permitted_attributes_for_update.map(&:to_sym)
27
+ p = ::Pundit.policy!(context[:user],_model_class)
28
+ p.allowed_fields(:write).map(&:to_sym)
28
29
  end
29
30
 
30
- def self.creatable_fields(context)
31
- ::Pundit.policy!(context[:user],_model).permitted_attributes_for_create.map(&:to_sym)
31
+ def creatable_fields(context)
32
+ p = ::Pundit.policy!(context[:user],_model_class)
33
+ p.allowed_fields(:write).map(&:to_sym)
32
34
  end
33
35
  end
34
36
 
@@ -90,6 +90,10 @@ module CrewdPolicies
90
90
  record.is_a?(Class) ? record : record.class
91
91
  end
92
92
 
93
+ def record_instance
94
+ record.is_a?(Class) ? nil : record
95
+ end
96
+
93
97
  def allowed?(aAbility,aFields=nil)
94
98
  if aFields
95
99
  pf = allowed_fields(aAbility)
@@ -1,3 +1,3 @@
1
1
  module CrewdPolicies
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crewd_policies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary McGhee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-01 00:00:00.000000000 Z
11
+ date: 2017-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pundit