effective_resources 2.2.0 → 2.2.2
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: 0eda305985b8b6f064121996ea89bdc6fa97dc96fbd0eaa0bf465b37097f815f
|
4
|
+
data.tar.gz: b962a2a0690c5931b8c86e730d3ea7cca7b47465451062360ec74873f94cd525
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c462cf9c88eab4d3d897fc5bd00738a61724fc4bf9f6587d38fa9ee3d726f57807c7a4b5d88ea3c83442fb99f255ade0977e18beedd6050506d1c77187e95913
|
7
|
+
data.tar.gz: 8c8b7f7fec0d143f561002e7c9b8b5d10aaceb1ab7c7d9747614d68a55b464366bafd7d1aee01b034edb2da65aad0d686c91252f28ee3da472d5adc9affc6e56
|
@@ -31,7 +31,7 @@ module Effective
|
|
31
31
|
|
32
32
|
# Duplicate if possible
|
33
33
|
if params[:duplicate_id]
|
34
|
-
duplicate = resource_scope.
|
34
|
+
duplicate = resource_scope.find_by_id(params[:duplicate_id])
|
35
35
|
EffectiveResources.authorize!(self, :show, duplicate)
|
36
36
|
|
37
37
|
self.resource = duplicate_resource(duplicate)
|
@@ -87,8 +87,9 @@ module Effective
|
|
87
87
|
|
88
88
|
def search_associated(name, value, as:, operation:)
|
89
89
|
reflection = associated(name)
|
90
|
+
|
90
91
|
raise("expected to find #{relation.klass.name} #{name} reflection") unless reflection
|
91
|
-
raise("
|
92
|
+
raise("unexpected search_associated operation #{operation || 'nil'}") unless [:eq, :matches, :does_not_match, :sql].include?(operation)
|
92
93
|
|
93
94
|
# Parse values
|
94
95
|
value_ids = value.kind_of?(Array) ? value : (value.to_s.split(/,|\s|\|/) - [nil, '', ' '])
|
@@ -283,6 +284,10 @@ module Effective
|
|
283
284
|
term = Attribute.new(as).parse(value, name: name) || value
|
284
285
|
|
285
286
|
searched = case as
|
287
|
+
when :active_storage
|
288
|
+
relation.send("with_attached_#{name}").references("#{name}_attachment")
|
289
|
+
.where(ActiveStorage::Blob.arel_table[:filename].matches("%#{term}%"))
|
290
|
+
|
286
291
|
when :date, :datetime
|
287
292
|
if value.kind_of?(String)
|
288
293
|
end_at = (
|
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: 2.2.
|
4
|
+
version: 2.2.2
|
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: 2023-01-
|
11
|
+
date: 2023-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|