effective_resources 1.0.1 → 1.0.2
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: ab07e09ae92fa3b5b45c6aaea043524311cf55ee
|
4
|
+
data.tar.gz: a1932eebb584d966fc283bde64a4ccef8da30fc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa2a85a3c35493d374fbd6ecc681edb1e33db170adc18e3b9839d2d5968c6f2b47cfa9fa862798d9e8b92e68b17da2a24c27b1aa8bdf2785851e3a1621a3102e
|
7
|
+
data.tar.gz: 035d29dfab61fd4de301630257e82f5022cc31bc57515065e17303eb703b1a000c524806961c189ee9265d29a6d6611f4fdc6932f4b35e8f6c930922936cdf5b
|
@@ -48,7 +48,7 @@ module EffectiveResourcesPrivateHelper
|
|
48
48
|
|
49
49
|
# Replace resource name in any token strings
|
50
50
|
if opts['data-confirm']
|
51
|
-
opts['data-confirm'].gsub!('@resource', (resource.to_s.presence || effective_resource.human_name))
|
51
|
+
opts['data-confirm'].gsub!('@resource', (resource.to_s.presence || effective_resource.human_name).to_s)
|
52
52
|
end
|
53
53
|
|
54
54
|
opts.except(:default, :only, :except, :if, :unless, :redirect, :success, :danger)
|
@@ -9,8 +9,8 @@ module Effective
|
|
9
9
|
@instance || klass.new
|
10
10
|
end
|
11
11
|
|
12
|
-
# called by effective_trash
|
13
|
-
def instance_attributes(include_associated: true)
|
12
|
+
# called by effective_trash and effective_logging
|
13
|
+
def instance_attributes(include_associated: true, include_nested: true)
|
14
14
|
return {} unless instance.present?
|
15
15
|
|
16
16
|
attributes = { attributes: instance.attributes }
|
@@ -20,16 +20,22 @@ module Effective
|
|
20
20
|
belong_tos.each do |association|
|
21
21
|
attributes[association.name] = instance.send(association.name).to_s
|
22
22
|
end
|
23
|
+
end
|
23
24
|
|
25
|
+
if include_associated || include_nested
|
24
26
|
nested_resources.each do |association|
|
25
27
|
attributes[association.name] ||= {}
|
26
28
|
|
29
|
+
next if association.options[:through]
|
30
|
+
|
27
31
|
Array(instance.send(association.name)).each_with_index do |child, index|
|
28
32
|
resource = Effective::Resource.new(child)
|
29
|
-
attributes[association.name][index] = resource.instance_attributes
|
33
|
+
attributes[association.name][index] = resource.instance_attributes(include_associated: include_associated, include_nested: include_nested)
|
30
34
|
end
|
31
35
|
end
|
36
|
+
end
|
32
37
|
|
38
|
+
if include_associated
|
33
39
|
has_ones.each do |association|
|
34
40
|
attributes[association.name] = instance.send(association.name).to_s
|
35
41
|
end
|
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.0.
|
4
|
+
version: 1.0.2
|
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: 2018-09-
|
11
|
+
date: 2018-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|