effective_resources 2.34.4 → 2.34.6
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: 3a79c20ed1ee3e1431b0bd8c48b3dba8e79b32399b47ae79112c0a12442f1086
|
|
4
|
+
data.tar.gz: d26fa6a177b49e83a063dd109c96188455817537c77ade219a54004ebc90dff9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: caaf3fa64b831e26364daaa80fede1bb5555de2425fcd201bcd3a8e364bb6af2dff1d52f29c2332504816317c59972a80c45fbb64596c91c9b7ef84f62212f78
|
|
7
|
+
data.tar.gz: 6c8be7d92251017a58bc2cf6e0e5a8125a63b12225e9b187ad2f2809972d5ed2aa839126580c9b0ffde69a82d1d9b9b0eee0d902b780166ec0abfde83c10c11a
|
|
@@ -84,6 +84,14 @@ module Effective
|
|
|
84
84
|
resource.created_by ||= (impersonation_user || current_user)
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
+
if respond_to?(:current_user) && resource.respond_to?(:updated_by=)
|
|
88
|
+
resource.updated_by ||= (impersonation_user || current_user)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
if resource.respond_to?(:current_path=)
|
|
92
|
+
resource.current_path ||= resource_path
|
|
93
|
+
end
|
|
94
|
+
|
|
87
95
|
resource.assign_attributes(send(resource_params_method_name))
|
|
88
96
|
|
|
89
97
|
EffectiveResources.authorize!(self, action, resource)
|
|
@@ -145,6 +153,10 @@ module Effective
|
|
|
145
153
|
resource.updated_by ||= (impersonation_user || current_user)
|
|
146
154
|
end
|
|
147
155
|
|
|
156
|
+
if resource.respond_to?(:current_path=)
|
|
157
|
+
resource.current_path ||= resource_path
|
|
158
|
+
end
|
|
159
|
+
|
|
148
160
|
resource.assign_attributes(send(resource_params_method_name))
|
|
149
161
|
|
|
150
162
|
if save_resource(resource, action)
|
|
@@ -201,6 +213,22 @@ module Effective
|
|
|
201
213
|
to_assign = (send(resource_params_method_name) rescue {})
|
|
202
214
|
resource.assign_attributes(to_assign) if to_assign.present? && to_assign.permitted?
|
|
203
215
|
|
|
216
|
+
if respond_to?(:current_user) && resource.respond_to?(:current_user=)
|
|
217
|
+
resource.current_user ||= current_user
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
if respond_to?(:current_user) && resource.respond_to?(:updated_by=)
|
|
221
|
+
resource.updated_by ||= (impersonation_user || current_user)
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
if respond_to?(:current_user) && resource.try(:new_record?) && resource.respond_to?(:created_by=)
|
|
225
|
+
resource.created_by ||= (impersonation_user || current_user)
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
if resource.respond_to?(:current_path=)
|
|
229
|
+
resource.current_path ||= resource_path
|
|
230
|
+
end
|
|
231
|
+
|
|
204
232
|
if save_resource(resource, action)
|
|
205
233
|
respond_with_success(resource, action)
|
|
206
234
|
else
|
|
@@ -150,6 +150,12 @@ module Effective
|
|
|
150
150
|
datatable
|
|
151
151
|
end
|
|
152
152
|
|
|
153
|
+
def resource_path
|
|
154
|
+
parts = controller_path.to_s.split('/')
|
|
155
|
+
parts.shift if defined?(Tenant) && parts.first == Tenant.current.to_s
|
|
156
|
+
parts.length > 1 ? parts.first.to_sym : nil
|
|
157
|
+
end
|
|
158
|
+
|
|
153
159
|
def resource_layout
|
|
154
160
|
namespace = controller_path.include?('admin/') ? 'admin' : 'application'
|
|
155
161
|
|
|
@@ -401,6 +401,8 @@ module Effective
|
|
|
401
401
|
def search_any(value, columns: nil, fuzzy: nil)
|
|
402
402
|
raise 'expected relation to be present' unless relation
|
|
403
403
|
|
|
404
|
+
columns = Array(columns).presence
|
|
405
|
+
|
|
404
406
|
# Assume this is a set of IDs
|
|
405
407
|
if columns.blank? || columns.include?(klass.primary_key) || columns.include?(klass.primary_key.to_sym)
|
|
406
408
|
if (value.kind_of?(Integer) || value.kind_of?(Array) || (value.to_i.to_s == value))
|
|
@@ -410,7 +412,7 @@ module Effective
|
|
|
410
412
|
|
|
411
413
|
# If the user specifies columns. Filter out invalid ones for this klass
|
|
412
414
|
if columns.present?
|
|
413
|
-
columns =
|
|
415
|
+
columns = columns.map(&:to_s) - [nil, '']
|
|
414
416
|
columns = (columns & search_columns)
|
|
415
417
|
end
|
|
416
418
|
|
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.34.
|
|
4
|
+
version: 2.34.6
|
|
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: 2026-
|
|
11
|
+
date: 2026-02-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|