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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1923808982223818b6cbc0b02c0554c0f407dfe76a905966dae854132ca1a58f
4
- data.tar.gz: eb139030c20e03404258c6ff448904b12c75b0057d56a230b96c3a584416745c
3
+ metadata.gz: 5bb55d787e51ce7a736895cad22e2c45efe0fb18aa7ece1f7b189ea3352c67c9
4
+ data.tar.gz: '01847855adb1f4206935e3acd4d2c7e3540e7e34ad7c7b82259d1bd1969c9f4f'
5
5
  SHA512:
6
- metadata.gz: 40992e933bb5a7b4915abc4b7508b7dceae4eeabc58b351544a3493247cbe1deb7b72c66efe532366e314766ae837222655b781a27b04674ced4b9fa990b0bca
7
- data.tar.gz: 77d99b96773894349afb1da8e873f45a7ad0f3a24a009e9f77e3d4d5cd1d7da8844daf2eb8105ea49f2cca4468f9ee6f48d8efc60c3a8488f22663ab98086d06
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(","))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FetcheableOnApi
4
- VERSION = '0.2.8'.freeze
4
+ VERSION = '0.2.9'.freeze
5
5
  end
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.8
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-03-21 00:00:00.000000000 Z
11
+ date: 2019-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport