effective_datatables 3.1.3 → 3.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2fd403395ba41023758912f2316bd3550ce87b0
|
4
|
+
data.tar.gz: da929e087db2cdf263b1c5f85c1e9304b834acfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 398b32bf5d7d09c1fe70f60b2cc7a808ba9d0e3d3203027503b3c88d292e1ef35c3941393055f87b74e1f25cedf3be2aa9b733af90a782209a0227daf33efd3b
|
7
|
+
data.tar.gz: 2ceb4c659055f4de79ce573078f7a0bc054fdb67533d560bc44ea75c59cec4ebff4fefb2902b4000dc50f810a59243d2a944ac05f17128d487da0f0782f1fa70
|
@@ -78,6 +78,9 @@ module Effective
|
|
78
78
|
# Figure out the class, and if it's activerecord, do all the resource discovery on it
|
79
79
|
load_resource!
|
80
80
|
|
81
|
+
# If attributes match a belongs_to column, scope the collection and remove the column
|
82
|
+
apply_belongs_to_attributes!
|
83
|
+
|
81
84
|
save_cookie!
|
82
85
|
end
|
83
86
|
|
@@ -146,6 +146,24 @@ module Effective
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
end
|
149
|
+
|
150
|
+
def apply_belongs_to_attributes!
|
151
|
+
return unless active_record_collection?
|
152
|
+
|
153
|
+
changed = attributes.any? do |attribute, value|
|
154
|
+
attribute = attribute.to_s
|
155
|
+
next unless attribute.ends_with?('_id')
|
156
|
+
|
157
|
+
associated = attribute.gsub(/_id\z/, '').to_sym # Replace last _id
|
158
|
+
next unless columns[associated] && columns[associated][:as] == :belongs_to
|
159
|
+
|
160
|
+
@_collection = @_collection.where(attribute => value)
|
161
|
+
columns.delete(associated)
|
162
|
+
end
|
163
|
+
|
164
|
+
columns.each_with_index { |(_, column), index| column[:index] = index } if changed
|
165
|
+
end
|
166
|
+
|
149
167
|
end
|
150
168
|
end
|
151
169
|
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: 3.
|
4
|
+
version: '3.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: 2017-
|
11
|
+
date: 2017-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|