effective_resources 1.9.12 → 1.9.16
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/concerns/effective/wizard_controller/actions.rb +1 -0
- data/app/models/concerns/acts_as_tokened.rb +1 -0
- data/app/models/effective/resources/forms.rb +5 -1
- data/app/models/effective/resources/relation.rb +12 -2
- data/lib/effective_resources/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: e2aae5d9ac90fa652dad2f7a60995282a9347dbfbbfdb0b497d1c46db42d7fe4
|
4
|
+
data.tar.gz: 9d19f8cc152193da25ab30c7a4bc43187f9e52fb4eb309c0751df134f2a76dbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f33925a5ae6b5eda2076f6a27607af422e02412db62b55d0b6175a77cff200c18450611c314680b54c7843b59bdc498b508b760c03221e47da2a6e62f59efb1
|
7
|
+
data.tar.gz: 71e9ab7dd0e61db615b043455459dad0de6b4e199f14ed39a0eb88ac16558d8b33d55bb9e0b95a2412dd4fa630ef277b198636078825ddb66d5c6db68c6b9fd3
|
@@ -40,6 +40,7 @@ module ActsAsTokened
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def to_global_id(**params)
|
43
|
+
params[:tenant] = Tenant.current if defined?(Tenant)
|
43
44
|
GlobalID.new(URI::GID.build(app: Rails.application.config.global_id.app, model_name: model_name, model_id: to_param, params: params))
|
44
45
|
end
|
45
46
|
|
@@ -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,18 @@ 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.unscoped.distinct("#{name}_type").pluck("#{name}_type").each do |klass_name|
|
104
|
+
next if klass_name.nil?
|
105
|
+
|
106
|
+
resource = Effective::Resource.new(klass_name)
|
107
|
+
next unless resource.klass.present?
|
108
|
+
|
109
|
+
collection = collection.or(relation.where("#{name}_id": resource.search_any(term), "#{name}_type": klass_name))
|
110
|
+
end
|
111
|
+
|
112
|
+
collection
|
103
113
|
end
|
104
114
|
when :has_and_belongs_to_many, :has_many, :has_one
|
105
115
|
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.16
|
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:
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|