effective_datatables 4.22.1 → 4.22.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: d637c86319bd250aa7a2c600360d4e2004fd2e8d5586f43ad8292a34310514e3
|
|
4
|
+
data.tar.gz: 06df86631378ee04e662771188dad2d809e58a05a4bf7b8498c5e1d680bf540a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 619c96422b2be2a6b8f568b3c2ee3350578b7e9ae69e416e357fbe21e4a734f5bdab048d5d4c29cd1fe7ed3f3c166b0bb9293a52f941f4636c263278482360b3
|
|
7
|
+
data.tar.gz: 5038f62833834b94010553369f5c1a2c19f7f0f2c1be245a90adcf696d1be120010b1b861e2b9640f19b6a2a647215191910fccdf7edd67faa780598eb199385
|
|
@@ -12,11 +12,6 @@ module Effective
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def load_attributes!
|
|
16
|
-
return unless view.respond_to?(:controller_path)
|
|
17
|
-
@attributes[:namespace] ||= view.controller_path.split('/')[0...-1].join('/')
|
|
18
|
-
end
|
|
19
|
-
|
|
20
15
|
# Polymorphic shorthand attributes.
|
|
21
16
|
# If you pass resource: User(1), it sets resource_id: 1, resource_type: 'User'
|
|
22
17
|
def initial_attributes(attributes)
|
|
@@ -35,6 +30,29 @@ module Effective
|
|
|
35
30
|
retval
|
|
36
31
|
end
|
|
37
32
|
|
|
33
|
+
def load_attributes!
|
|
34
|
+
return unless view.respond_to?(:controller_path)
|
|
35
|
+
|
|
36
|
+
# Assign namespace based off controller path unless given
|
|
37
|
+
@attributes[:namespace] ||= view.controller_path.split('/')[0...-1].join('/')
|
|
38
|
+
|
|
39
|
+
# If there are attributes[:user_type] and attributes[:user_id] type attributes load them into attributes[:user]
|
|
40
|
+
resource_attributes = @attributes.select do |key, value|
|
|
41
|
+
name = key.to_s
|
|
42
|
+
base = name.sub('_type', '')
|
|
43
|
+
|
|
44
|
+
name.ends_with?('_type') && @attributes.key?("#{base}_id".to_sym) && value.safe_constantize.present?
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
resource_attributes.each do |key, value|
|
|
48
|
+
name = key.to_s
|
|
49
|
+
base = name.sub('_type', '')
|
|
50
|
+
|
|
51
|
+
klass = value.constantize
|
|
52
|
+
@attributes[base.to_sym] ||= klass.find(attributes["#{base}_id".to_sym])
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
38
56
|
end
|
|
39
57
|
end
|
|
40
58
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: effective_datatables
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.22.
|
|
4
|
+
version: 4.22.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: 2024-01-
|
|
11
|
+
date: 2024-01-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|