fetcheable_on_api 0.2.8 → 0.2.9
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/filterable.rb +5 -0
- data/lib/fetcheable_on_api/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: 5bb55d787e51ce7a736895cad22e2c45efe0fb18aa7ece1f7b189ea3352c67c9
|
4
|
+
data.tar.gz: '01847855adb1f4206935e3acd4d2c7e3540e7e34ad7c7b82259d1bd1969c9f4f'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04eca701b11c614adaf3710176ef1f13b02eb9ee4796e41e8e312753a09531e427c6ec41962b888cebf9002203ecc2a9b214c86f5eb73852a7bab917ff9c3568
|
7
|
+
data.tar.gz: 8791797d2dd3988264a584f9cd2d8cce37efc64575680aa5ca1f55af84641bac8c94f43ef43651bf4ea53acc1965fc5d7aedc18e99c79a5d044218a650a80cee
|
@@ -109,8 +109,13 @@ module FetcheableOnApi
|
|
109
109
|
format = filters_configuration[column.to_sym].fetch(:format, :string)
|
110
110
|
column_name = filters_configuration[column.to_sym].fetch(:as, column)
|
111
111
|
klass = filters_configuration[column.to_sym].fetch(:class_name, collection.klass)
|
112
|
+
collection_klass = collection.name.constantize
|
112
113
|
predicate = filters_configuration[column.to_sym].fetch(:with, :ilike)
|
113
114
|
|
115
|
+
if collection_klass != klass
|
116
|
+
collection = collection.joins(klass.table_name.to_sym)
|
117
|
+
end
|
118
|
+
|
114
119
|
if %i[between not_between].include?(predicate)
|
115
120
|
if values.is_a?(String)
|
116
121
|
predicates(predicate, collection, klass, column_name, values.split(","))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fetcheable_on_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabien
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|