active_scaffold 4.0.11 → 4.0.12
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.
Potentially problematic release.
This version of active_scaffold might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +2 -0
- data/lib/active_scaffold/helpers/association_helpers.rb +19 -1
- data/lib/active_scaffold/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb3908fe52caa2dcc8698d6430befa7b2e71580df16dc97536b120f145126015
|
4
|
+
data.tar.gz: b53eff968492567216dad68a739cc17d63acfb945f2b24b7a59ae7364347323b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c95576ddc492127de9a0f21afff8847a8660d9141e7ce255ab7654b5cb4881bab36f3d12c38f2c250f3c8526c97989daf3254758b7d8f1112371fbb4099dd096
|
7
|
+
data.tar.gz: e40187cbc740f4bc7af4910d0aab40d3969904b5bd5de3c976adfaba486bff70348a90da13b7377b2286a9628d1ad8cbde9fc183226b118d4fc39a4a339e7433
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
- Filter includes for the selected model in select form_ui when column is a polymorphic association, as includes for polymorphic association may be a hash with the polymorphic association as key and associations of different models in the value
|
2
|
+
|
1
3
|
= 4.0.11
|
2
4
|
- Fix refresh_link with update_columns
|
3
5
|
|
@@ -36,7 +36,7 @@ module ActiveScaffold
|
|
36
36
|
relation = klass.where(conditions)
|
37
37
|
column = column_for_association(association, record)
|
38
38
|
if column&.includes
|
39
|
-
include_assoc = column
|
39
|
+
include_assoc = includes_for_association(column, klass)
|
40
40
|
relation = relation.includes(include_assoc[association.name]) if include_assoc
|
41
41
|
end
|
42
42
|
if column&.sort && column.sort&.dig(:sql)
|
@@ -49,6 +49,24 @@ module ActiveScaffold
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
def includes_for_association(column, klass)
|
53
|
+
includes = column.includes.find { |assoc| assoc.is_a?(Hash) && assoc.include?(column.association.name) }
|
54
|
+
return unless includes
|
55
|
+
|
56
|
+
includes = includes[association.name]
|
57
|
+
if column.association.polymorphic?
|
58
|
+
includes = Array.wrap(includes).filter_map do |assoc|
|
59
|
+
if assoc.is_a?(Hash)
|
60
|
+
assoc.select { |key, _| klass.reflect_on_association(key) }.presence
|
61
|
+
elsif klass.reflect_on_association(assoc)
|
62
|
+
assoc
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
includes.presence
|
68
|
+
end
|
69
|
+
|
52
70
|
def column_for_association(association, record)
|
53
71
|
active_scaffold_config_for(record.class).columns[association.name]
|
54
72
|
rescue StandardError => e
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Many, see README
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|