iknow_view_models 3.2.11 → 3.2.12
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 284af292a0f1a70b761afd2e3ef084ad9f8f5853f00c8af8ac2d3b1227eb9cb5
|
4
|
+
data.tar.gz: 61fdea22a0b13db50e7b237e472900eef376e95d04fed5f21a8c1ef7422aaa56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64ffd808756c298236f4e00b11cdf7f1410019bc506f306c6cfbaa97b953212a5c58e7b56263deac0aac5e80398fa2d551922d6b90d7a3c60732a50b66467384
|
7
|
+
data.tar.gz: ccd3301209a94c8e9cd9a44166b153ae3edafab81cfe49498849e6c22dc413956d33e3cdba0ab001456122f47400df47dfbe327d9a9005f1947c512da3d9e523
|
@@ -340,12 +340,15 @@ class ViewModel::ActiveRecord < ViewModel::Record
|
|
340
340
|
|
341
341
|
case
|
342
342
|
when association_data.through?
|
343
|
-
# associated here are
|
343
|
+
# associated here are join-table models; we need to get the far side out
|
344
|
+
join_models = associated
|
345
|
+
|
344
346
|
if association_data.direct_viewmodel._list_member?
|
345
|
-
|
347
|
+
attr = association_data.direct_viewmodel._list_attribute_name
|
348
|
+
join_models = join_models.sort_by { |j| j[attr] }
|
346
349
|
end
|
347
350
|
|
348
|
-
|
351
|
+
join_models.map do |through_model|
|
349
352
|
model = through_model.public_send(association_data.indirect_reflection.name)
|
350
353
|
association_data.viewmodel_class_for_model!(model.class).new(model)
|
351
354
|
end
|
@@ -101,8 +101,10 @@ class ViewModel::ActiveRecord::HasManyThroughTest < ActiveSupport::TestCase
|
|
101
101
|
@tag1, @tag2, @tag3 = (1..3).map { |x| Tag.create!(name: "tag#{x}") }
|
102
102
|
|
103
103
|
@parent1 = Parent.create(name: 'p1',
|
104
|
-
parents_tags: [
|
105
|
-
|
104
|
+
parents_tags: [
|
105
|
+
ParentsTag.new(tag: @tag2, position: 2.0),
|
106
|
+
ParentsTag.new(tag: @tag1, position: 1.0),
|
107
|
+
])
|
106
108
|
|
107
109
|
enable_logging!
|
108
110
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iknow_view_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iKnow Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|