avo 3.17.8.tw4 → 3.17.9.tw4
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 +4 -4
- data/Gemfile.lock +2 -2
- data/app/assets/builds/avo.base.css +1 -1
- data/app/assets/builds/avo.base.js +48 -38
- data/app/assets/builds/avo.base.js.map +3 -3
- data/lib/avo/resources/array_resource.rb +7 -7
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/resource_generator.rb +1 -1
- metadata +2 -2
@@ -13,15 +13,15 @@ module Avo
|
|
13
13
|
|
14
14
|
class << self
|
15
15
|
def model_class
|
16
|
-
@@model_class ||=
|
17
|
-
|
16
|
+
@@model_class ||= Avo.const_set(
|
17
|
+
class_name,
|
18
18
|
Class.new do
|
19
19
|
include ActiveModel::Model
|
20
20
|
|
21
21
|
class << self
|
22
22
|
def primary_key = nil
|
23
23
|
|
24
|
-
def all = "Avo::Resources::#{
|
24
|
+
def all = "Avo::Resources::#{class_name}".constantize.new.fetch_records
|
25
25
|
end
|
26
26
|
end
|
27
27
|
)
|
@@ -40,7 +40,7 @@ module Avo
|
|
40
40
|
|
41
41
|
def fetch_records(array_of_records = nil)
|
42
42
|
array_of_records ||= records
|
43
|
-
raise "Unable to fetch any #{
|
43
|
+
raise "Unable to fetch any #{class_name}" if array_of_records.nil?
|
44
44
|
|
45
45
|
# When the array of records is declared in a field's block, we need to get that block from the parent resource
|
46
46
|
# If there is no block try to pick those from the parent_record
|
@@ -68,8 +68,8 @@ module Avo
|
|
68
68
|
# Dynamically create a class with accessors for all unique keys from the records
|
69
69
|
keys = array_of_records.flat_map(&:keys).uniq
|
70
70
|
|
71
|
-
|
72
|
-
|
71
|
+
Avo.const_set(
|
72
|
+
class_name,
|
73
73
|
Class.new do
|
74
74
|
include ActiveModel::Model
|
75
75
|
|
@@ -82,7 +82,7 @@ module Avo
|
|
82
82
|
end
|
83
83
|
)
|
84
84
|
|
85
|
-
custom_class =
|
85
|
+
custom_class = "Avo::#{class_name}".constantize
|
86
86
|
|
87
87
|
# Map the records to instances of the dynamically created class
|
88
88
|
array_of_records.map do |item|
|
data/lib/avo/version.rb
CHANGED
@@ -228,7 +228,7 @@ module Generators
|
|
228
228
|
# If the through_reflection is not a HasManyReflection, add it to the fields hash using the class of the through_reflection
|
229
229
|
# ex (team.rb): has_one :admin, through: :admin_membership, source: :user
|
230
230
|
# we use the class of the through_reflection (HasOneReflection -> has_one :admin) to generate the field
|
231
|
-
|
231
|
+
::Avo::Mappings::ASSOCIATIONS_MAPPING[association.through_reflection.class]
|
232
232
|
end
|
233
233
|
end
|
234
234
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.17.
|
4
|
+
version: 3.17.9.tw4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2025-02-
|
13
|
+
date: 2025-02-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|