effective_resources 1.5.0 → 1.5.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0088b5cd07643454e1be8f7c9e01ccd0f5c1b7f93711b9cb86f90e03b74fa463'
|
4
|
+
data.tar.gz: e1e1fc6e1e3f3f2d025112681a0e868252f176e447ee9245800994f9b308e41e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a8171a67e5006edbe0b7e3fe17e9e826f8657325314d285fc866328306d54ae14865f5126024f378e77612846aa7d7b8498f102443cfb5e5b7392210dda8deb
|
7
|
+
data.tar.gz: b02c0e21f4263200e8cccec56e4948466a889028ea2ce8d3eb24386776e4e5549255befc769dcb1c60f3c3a2870a02faee3218e0fd74bdae103e5a576f638475
|
@@ -26,7 +26,10 @@ module Effective
|
|
26
26
|
|
27
27
|
def has_ones
|
28
28
|
return [] unless klass.respond_to?(:reflect_on_all_associations)
|
29
|
-
|
29
|
+
|
30
|
+
blacklist = ['ActiveStorage::', 'ActionText::']
|
31
|
+
|
32
|
+
klass.reflect_on_all_associations(:has_one).reject { |ass| blacklist.any? { |val| ass.class_name.start_with?(val) } }
|
30
33
|
end
|
31
34
|
|
32
35
|
def has_ones_ids
|
@@ -66,6 +69,14 @@ module Effective
|
|
66
69
|
active_storage_has_ones.map { |ass| ass.name.to_s.gsub(/_attachment\z/, '').to_sym }
|
67
70
|
end
|
68
71
|
|
72
|
+
def active_texts
|
73
|
+
klass.reflect_on_all_associations(:has_one).select { |ass| ass.class_name == 'ActionText::RichText' }
|
74
|
+
end
|
75
|
+
|
76
|
+
def active_texts_has_ones_ids
|
77
|
+
active_texts.map { |ass| ass.name.to_s.gsub(/\Arich_text_/, '').to_sym }
|
78
|
+
end
|
79
|
+
|
69
80
|
def nested_resources
|
70
81
|
return [] unless klass.respond_to?(:reflect_on_all_associations)
|
71
82
|
klass.reflect_on_all_associations(:has_many).select { |ass| ass.options[:autosave] } +
|
@@ -153,7 +164,3 @@ module Effective
|
|
153
164
|
end
|
154
165
|
end
|
155
166
|
end
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
@@ -52,6 +52,12 @@ module Effective
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
def active_text_attributes
|
56
|
+
{}.tap do |retval|
|
57
|
+
active_texts_has_ones_ids.each { |k, v| retval[k] = [:string] }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
55
61
|
# All will include primary_key, created_at, updated_at and belongs_tos
|
56
62
|
# This is the attributes as defined by the effective_resources do .. end block
|
57
63
|
# { :name => [:string, { permitted: false }], ... }
|
@@ -66,6 +72,7 @@ module Effective
|
|
66
72
|
.merge(effective_addresses_attributes)
|
67
73
|
.merge(effective_assets_attributes)
|
68
74
|
.merge(active_storage_attributes)
|
75
|
+
.merge(active_text_attributes)
|
69
76
|
.merge(atts)
|
70
77
|
else # This is the migrator. This should match table_attributes
|
71
78
|
belong_tos_attributes.merge(atts.reject { |_, v| v[0] == :permitted_param })
|
@@ -137,7 +144,3 @@ module Effective
|
|
137
144
|
end
|
138
145
|
end
|
139
146
|
end
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
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.5.
|
4
|
+
version: 1.5.1
|
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: 2020-
|
11
|
+
date: 2020-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
|
-
rubygems_version: 3.1.
|
116
|
+
rubygems_version: 3.1.4
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: Make any controller an effective resource controller.
|