fetcheable_on_api 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fetcheable_on_api/sortable.rb +2 -2
- data/lib/fetcheable_on_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86236648008d977d8cf84a2b083af86581079912d4b1d7f10e801f098baa66b4
|
4
|
+
data.tar.gz: aed101c2b06e89e8d343af140d50d292cbe4e796061d3bdc426a7b768a804a9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ace285bdcafbd9946f312c7964528dba3be9a3da1a9f5e358fa5922be692593bf16685d7745c43f541bea6727b9c3f2819a067ddda1f6398a02beb68be066f58
|
7
|
+
data.tar.gz: 5aebd924fb07e8171021e6a5d9bf86806bf6c0b304709cf32e97917adb9e50d96706912aac4064087cefd02a98ad84d7bdbecc609816f969fe47b37b97941066
|
@@ -55,7 +55,7 @@ module FetcheableOnApi
|
|
55
55
|
foa_valid_parameters!(:sort, foa_permitted_types: [String])
|
56
56
|
|
57
57
|
ordering = format_params(params[:sort]).map do |attr_name, sort_method|
|
58
|
-
arel_sort(attr_name, sort_method)
|
58
|
+
arel_sort(attr_name, sort_method, collection)
|
59
59
|
end
|
60
60
|
|
61
61
|
collection.order(ordering.compact)
|
@@ -63,7 +63,7 @@ module FetcheableOnApi
|
|
63
63
|
|
64
64
|
private
|
65
65
|
|
66
|
-
def arel_sort(attr_name, sort_method)
|
66
|
+
def arel_sort(attr_name, sort_method, collection)
|
67
67
|
return if sorts_configuration[attr_name].blank?
|
68
68
|
|
69
69
|
klass = class_for(attr_name, collection)
|