crewd_policies 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1faadaf0ead8b222055bd12352c9a9e60b37b1c
4
- data.tar.gz: 32d9daabec143d2762d0c94d465190f1c68e9820
3
+ metadata.gz: f2ccb5b994f527abdf5cf5a3531d6c7a265df0a2
4
+ data.tar.gz: 394164bede7020671253fdab0b58a8cd636c8aa5
5
5
  SHA512:
6
- metadata.gz: 3747e925434b48677568789ed8c4275863d2f7e88d2ad11f967a93db2295d1dcd538bf8a96f8bb8fd0723690a1f6eaa4cd04e56a59b5308882f5035315ec5347
7
- data.tar.gz: bdb2da59bb045ff010ea957b174fd6d840c252983ebb689ca5dc9c173a27a06707761da45e44ff6c0fea34156c20a12d4fb5cd19d84b6c150030ff7a64074e19
6
+ metadata.gz: af545d247798a06bdaa90f48857c7c15b545872d5247d426bd1cec4686bb24a13f9979c32eec32914afc2ba09a1be361a5dea06fc0802a9494212cc6f9b5d472
7
+ data.tar.gz: c471f30ba88ab063b483c276e40c8b7e6154c89c7dd6db3ff4e010c547ecf358bbda767814fa60ba68b33eddf51e5b3263e5253cbfa2be2ce3f6e20b964585e9
@@ -18,7 +18,9 @@ module CrewdPolicies
18
18
 
19
19
  def inherited(subclass)
20
20
  super
21
- attrs = subclass._model_class.column_names.map(&:to_sym)
21
+ cls = subclass._model_class
22
+ attrs = cls.roles_rules.values.flatten.map{|h| h[:fields]}.compact.flatten.uniq.map(&:to_sym) # all fields from all rules
23
+ attrs.delete_if { |f| cls.reflections.has_key? f.to_s } if cls.respond_to? :reflections # remove associations
22
24
  attrs -= [:id]
23
25
  subclass.send(:attributes, *attrs) unless attrs.empty?
24
26
  end
@@ -1,3 +1,3 @@
1
1
  module CrewdPolicies
2
- VERSION = "0.3.3"
2
+ VERSION = "0.4.0"
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.3
4
+ version: 0.4.0
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-11 00:00:00.000000000 Z
11
+ date: 2017-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pundit