effective_datatables 4.22.1 → 4.22.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59a32fa9af3a17a46a2f0ba0149dc47a1d6b58301b36a8ee73824552867b1b38
|
4
|
+
data.tar.gz: e0f6bfaf0037d47b7be43d8ca71f47cf72ca3c547c61a8cf65b1cf4e3fcc8fb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1397ea1f8d7941a37cfe0da34a53b0f23843ec72d4200314ac496a9446306f077267a4c261eba9de14b00f6c0943238175613101c5d6c11053fefcd7fba88fc6
|
7
|
+
data.tar.gz: 5590659c494da1e65936d9ed42eb4f95d56a57e079e2ead6a9b9cb210b8ba9feba4952c21ac56c54bab4b6820b013b30077df79276fc468b71a177d0d75193e3
|
@@ -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_by_id(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.3
|
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
|