forest_liana 1.5.19 → 1.5.20
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/app/controllers/forest_liana/apimaps_controller.rb +1 -1
- data/app/controllers/forest_liana/application_controller.rb +1 -1
- data/app/controllers/forest_liana/sessions_controller.rb +1 -1
- data/app/deserializers/forest_liana/resource_deserializer.rb +5 -1
- data/app/services/forest_liana/resources_getter.rb +16 -5
- data/lib/forest_liana/version.rb +1 -1
- data/test/dummy/app/controllers/application_controller.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0609cf8516ae79379606bff03060b124cb88329
|
4
|
+
data.tar.gz: e46eb8f4d03d79cd6b7ac90b731c010e337180ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a7c1cee91ef4161f980b81ba71cd2ea0569f41ea6ecf1b8058d437718fba656607ad15efff5e8e3f410bdc5e33467c40638dd45e945215f76053aed3157cc02
|
7
|
+
data.tar.gz: 21941decf71abafbaa33ef7faa7bd6a265be8d8d40dfd3fa4562214a57aff1e0f26c5b63e9eac2d6ecae89e24b3e5b47fb4a5f570bea2dc98bda4366a6a56319
|
@@ -96,7 +96,11 @@ module ForestLiana
|
|
96
96
|
|
97
97
|
@params['data']['attributes'].each do |key, value|
|
98
98
|
if value && carrierwave_attribute?(key)
|
99
|
-
|
99
|
+
if value.match(/\Adata:\w+\/.+;base64,.+/)
|
100
|
+
@attributes[key] = ForestLiana::Base64StringIO.new(value)
|
101
|
+
else
|
102
|
+
@attributes.delete(key)
|
103
|
+
end
|
100
104
|
end
|
101
105
|
end
|
102
106
|
end
|
@@ -3,6 +3,7 @@ module ForestLiana
|
|
3
3
|
def initialize(resource, params)
|
4
4
|
@resource = resource
|
5
5
|
@params = params
|
6
|
+
@count_needs_includes = false
|
6
7
|
@field_names_requested = field_names_requested
|
7
8
|
|
8
9
|
get_segment()
|
@@ -17,18 +18,25 @@ module ForestLiana
|
|
17
18
|
@records = @records.where(@segment.where.call())
|
18
19
|
end
|
19
20
|
|
20
|
-
@records = @records.eager_load(includes)
|
21
|
-
|
22
21
|
@records = search_query
|
23
|
-
@
|
22
|
+
@records_to_count = @records
|
23
|
+
|
24
|
+
# NOTICE: For performance reasons, do not eager load the data if there is
|
25
|
+
# no search or filters on associations.
|
26
|
+
if @count_needs_includes
|
27
|
+
@records_to_count = @records_to_count.eager_load(includes)
|
28
|
+
end
|
29
|
+
|
30
|
+
@records = @records.eager_load(includes)
|
31
|
+
@records_sorted = sort_query
|
24
32
|
end
|
25
33
|
|
26
34
|
def records
|
27
|
-
@
|
35
|
+
@records_sorted.offset(offset).limit(limit).to_a
|
28
36
|
end
|
29
37
|
|
30
38
|
def count
|
31
|
-
@
|
39
|
+
@records_to_count.count
|
32
40
|
end
|
33
41
|
|
34
42
|
def includes
|
@@ -67,10 +75,13 @@ module ForestLiana
|
|
67
75
|
@params[:filter].each do |field, values|
|
68
76
|
if field.include? ':'
|
69
77
|
associations_for_query << field.split(':').first.to_sym
|
78
|
+
@count_needs_includes = true
|
70
79
|
end
|
71
80
|
end
|
72
81
|
end
|
73
82
|
|
83
|
+
@count_needs_includes = true if @params[:search]
|
84
|
+
|
74
85
|
if @params[:sort] && @params[:sort].include?('.')
|
75
86
|
associations_for_query << @params[:sort].split('.').first.to_sym
|
76
87
|
end
|
data/lib/forest_liana/version.rb
CHANGED