effective_datatables 4.8.3 → 4.8.4

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: b1ebc0017738a2fc14868698d1ea0bc18e96c30b796abfc1c2b13e56a08e0af7
4
- data.tar.gz: d3207a967e3ef7864da7865af6c9c349cc414a9a4d137437798c21971bc9dfe5
3
+ metadata.gz: 53f857de2d8388bada0837e3eca598ab75e45cba907bde7b43c01a13c2037cb1
4
+ data.tar.gz: '0488a5bf9fafd8a54833615f6d7610d22567d97c5e1b0d13cd2476e24706d08b'
5
5
  SHA512:
6
- metadata.gz: cedbeff6abe599502b345b034cb8c62aa27c404b72d27baa1d0648273b73731bcfba68437854458bc69e986eadf6936407513275234c594ffc3c6c0619c23860
7
- data.tar.gz: '04650818c9871e4ba2e00ff07d919b9b81c25b867e6033626d6b41004cf7e51fc8943751ca0c8762d83040473127a92672906e6217a677fced997f024ff6510e'
6
+ metadata.gz: 740d034417e5aa04860b12a308f4e495b3856c4b86a67443f6ec2e18900a55be58c6edb7235d8ef66981bb827f05ecab29d3f691765b5dee43f5312804644adf
7
+ data.tar.gz: 91712a50aff213013867fd46bbdedc717e0c95fef1748d2d9076bfdd5930ce14a3fff1d158f0feed409c8431fb16b317fae1c34b21accd855546dc089c9dbb0d
@@ -4,7 +4,7 @@ module Effective
4
4
  AGGREGATE_SQL_FUNCTIONS = ['ARRAY_AGG(', 'AVG(', 'COUNT(', 'MAX(', 'MIN(', 'STRING_AGG(', 'SUM(']
5
5
 
6
6
  def admin_namespace?
7
- controller_namespace == 'admin'
7
+ [:admin, 'admin'].include?(controller_namespace)
8
8
  end
9
9
 
10
10
  def controller_namespace
@@ -200,6 +200,7 @@ module Effective
200
200
 
201
201
  def load_resource_belongs_tos!
202
202
  return unless active_record_collection?
203
+ return unless @_collection_apply_belongs_to
203
204
 
204
205
  changed = attributes.select do |attribute, value|
205
206
  attribute = attribute.to_s
@@ -210,7 +211,7 @@ module Effective
210
211
  next unless columns[associated]
211
212
 
212
213
  if columns[associated][:as] == :belongs_to
213
- if @_collection_apply_belongs_to && !@_collection.where_values_hash.include?(attribute)
214
+ unless @_collection.where_values_hash.include?(attribute)
214
215
  @_collection = @_collection.where(attribute => value)
215
216
  end
216
217
 
@@ -218,10 +219,8 @@ module Effective
218
219
  elsif columns[associated][:as] == :belongs_to_polymorphic
219
220
  associated_type = attributes["#{associated}_type".to_sym] || raise("Expected #{associated}_type attribute to be present when #{associated}_id is present on a polymorphic belongs to")
220
221
 
221
- if @_collection_apply_belongs_to
222
- if !@_collection.where_values_hash.include?(attribute) && !@_collection.where_values_hash.include?("#{associated}_type")
223
- @_collection = @_collection.where(attribute => value).where("#{associated}_type" => associated_type)
224
- end
222
+ unless @_collection.where_values_hash.include?(attribute) || @_collection.where_values_hash.include?("#{associated}_type")
223
+ @_collection = @_collection.where(attribute => value).where("#{associated}_type" => associated_type)
225
224
  end
226
225
 
227
226
  columns.delete(associated)
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.8.3'.freeze
2
+ VERSION = '4.8.4'.freeze
3
3
  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.8.3
4
+ version: 4.8.4
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: 2020-07-02 00:00:00.000000000 Z
11
+ date: 2020-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails