effective_resources 1.9.12 → 1.9.13
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed166aa8aeaf93b66de29429230623cad83d1b55f61b550f0b6e028d619c7362
|
4
|
+
data.tar.gz: 2843fd945c1c9dde784387b7db0d8b38187542f54aeaadee71876a1933c2c46f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 144e3041a712292e4a7becf6ff9e71c4092c50bff7ebbb06d13fc8f14f92c3ff9a1dcf3aaf20f4c5e5b06a1b6d52745930ab3fe877c88ca5f4c8c9d6a8ee16e3
|
7
|
+
data.tar.gz: e69d047183677c0176e6ffd941983a73bedf40040e49d413f1ea738766193eb686b52bfdb0063c7ca2f1bd637b753264708a99d41d254479689d2c52cc042fcf
|
@@ -21,7 +21,11 @@ module Effective
|
|
21
21
|
collection ||= (klass.const_get(constant_pluralized) rescue nil) if defined?("#{klass.name}::#{constant_pluralized}")
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
if collection.present?
|
25
|
+
{ as: :select, polymorphic: true, collection: (collection || []) }
|
26
|
+
else
|
27
|
+
{ as: :string }
|
28
|
+
end
|
25
29
|
when :has_and_belongs_to_many
|
26
30
|
{ as: :select }.merge(search_form_field_collection(has_and_belongs_to_many(name)))
|
27
31
|
when :has_many
|
@@ -98,8 +98,16 @@ module Effective
|
|
98
98
|
elsif name == :user # Polymorphic user
|
99
99
|
relation.where(search_by_associated_conditions(association, term, fuzzy: fuzzy))
|
100
100
|
else # Maybe from a string field
|
101
|
-
|
102
|
-
|
101
|
+
collection = relation.none
|
102
|
+
|
103
|
+
relation.distinct("#{name}_type").pluck("#{name}_type").each do |klass_name|
|
104
|
+
resource = Effective::Resource.new(klass_name)
|
105
|
+
next unless resource.klass.present?
|
106
|
+
|
107
|
+
collection = collection.or(relation.where("#{name}_id": resource.search_any(term), "#{name}_type": klass_name))
|
108
|
+
end
|
109
|
+
|
110
|
+
collection
|
103
111
|
end
|
104
112
|
when :has_and_belongs_to_many, :has_many, :has_one
|
105
113
|
relation.where(search_by_associated_conditions(association, term, fuzzy: fuzzy))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|