effective_resources 1.1.2 → 1.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e14f7c83d7a643249e87588a22d4f53cca940de2
|
4
|
+
data.tar.gz: e93845d47bbd5edf230481ceba29d8c88d6582e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a21d5b413d009156de7d4c24da2b1607ddbfac8e5c4dc566264c053e5ff07cb9c4f1ad5a67f326af3537244bca2bf654059230706416dde3a7430b2e7229900
|
7
|
+
data.tar.gz: 82a0760f7d0893323317029defb3afd409d05cc66b07501bccfeebcad4bea644e48598c1ba6c309cb983b69048a20a409090974ce31eeb441d3cfbe99e581eda
|
@@ -70,6 +70,8 @@ module Effective
|
|
70
70
|
{ k => [] }
|
71
71
|
elsif datatype == :permitted_param && k.to_s.ends_with?('_ids')
|
72
72
|
{ k => [] }
|
73
|
+
elsif datatype == :permitted_param && v.key?(:permitted_attributes)
|
74
|
+
{ k => v[:permitted_attributes] }
|
73
75
|
elsif datatype == :effective_address
|
74
76
|
{ k => EffectiveAddresses.permitted_params }
|
75
77
|
elsif datatype == :effective_assets
|
@@ -20,7 +20,17 @@ module Effective
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# Not really an attribute, just a permitted param.
|
23
|
-
|
23
|
+
# something permitted: true
|
24
|
+
if args.first.kind_of?(Hash) && args.first.key?(:permitted)
|
25
|
+
args.unshift(:permitted_param)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Specifying permitted param attributes
|
29
|
+
# invitation [:name, :email], permitted: true
|
30
|
+
if args.first.kind_of?(Array)
|
31
|
+
options = args.find { |arg| arg.kind_of?(Hash) } || { permitted: true }
|
32
|
+
args = [:permitted_param, options.merge(permitted_attributes: args.first)]
|
33
|
+
end
|
24
34
|
|
25
35
|
unless DATATYPES.include?(args.first)
|
26
36
|
raise "expected first argument to be a datatype. Try name :string"
|
@@ -29,6 +29,8 @@ module Effective
|
|
29
29
|
next if association.options[:through]
|
30
30
|
|
31
31
|
Array(instance.send(association.name)).each_with_index do |child, index|
|
32
|
+
next unless child.present?
|
33
|
+
|
32
34
|
resource = Effective::Resource.new(child)
|
33
35
|
attributes[association.name][index] = resource.instance_attributes(include_associated: include_associated, include_nested: include_nested)
|
34
36
|
end
|
@@ -54,9 +56,9 @@ module Effective
|
|
54
56
|
|
55
57
|
# used by effective_logging
|
56
58
|
def instance_changes
|
57
|
-
return {} unless (instance.present? && instance.
|
59
|
+
return {} unless (instance.present? && instance.previous_changes.present?)
|
58
60
|
|
59
|
-
changes = instance.
|
61
|
+
changes = instance.previous_changes.dup.delete_if do |attribute, (before, after)|
|
60
62
|
begin
|
61
63
|
(before.kind_of?(ActiveSupport::TimeWithZone) && after.kind_of?(ActiveSupport::TimeWithZone) && before.to_i == after.to_i) ||
|
62
64
|
(before == nil && after == false) || (before == nil && after == ''.freeze)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|