effective_datatables 2.1.13 → 2.1.14

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
  SHA1:
3
- metadata.gz: 95c93fe59f1b8b37e77d7c6378d70eabc24472d6
4
- data.tar.gz: 975e8314174671de14e44628f5471f4b9e1a22d7
3
+ metadata.gz: e90ec2c77193da9eb07f632193c5cf1714a8c121
4
+ data.tar.gz: c52a0ff93cc7aa36593309bdeb301cdcc7ee675d
5
5
  SHA512:
6
- metadata.gz: 3dc2d7c92bdebc4a3825b001f6de71bcffd314f35f85d5357e7ce888ddf0518a2099f8b92d7ddc0e7c72eaafcfb318b996431d2ae0043f24c1a11173d77f0de2
7
- data.tar.gz: cb825d287eef00abe406ed95ea5c2998212276f126853126023275579f1cd04278df3ffee4632b5939d3842474025dc12970c3160957ce356c7fad8720575002
6
+ metadata.gz: eabd2993073736222a0396e30a702c8f4d3c8266f351315d1b72b74cb6cf445cc43a9c0eedf97f0c6c384de0d6ee35ac53dbe843fa5f1ee5246f2d99abc05c68
7
+ data.tar.gz: 37376c4a58bdf27a70f6681621aad9b8bc7e9a74505efa2fc61f556690252c84efa57e442e13722797d26caae4833d54983435f3c76b4fa6f28e4ccfa62ca410
@@ -25,9 +25,9 @@ module Effective
25
25
  if [:string, :text].include?(order_column[:type]) && order_column[:sql_as_column] != true
26
26
  collection.order("COALESCE(#{column}, '') #{order_direction}")
27
27
  elsif order_column[:type] == :belongs_to_polymorphic
28
- collection.order("(#{column.sub('_id"', '_type"')}, #{column}) #{order_direction} NULLS LAST")
28
+ collection.order("(#{column.sub('_id"', '_type"')}, #{column}) #{order_direction}")
29
29
  else
30
- collection.order("#{column} #{order_direction} NULLS LAST")
30
+ collection.order("COALESCE(#{column}, '') #{order_direction}")
31
31
  end
32
32
  end
33
33
 
@@ -117,6 +117,8 @@ module Effective
117
117
  rescue => e
118
118
  collection
119
119
  end
120
+ when :boolean
121
+ collection.public_send(sql_op, "#{column} = :term", term: [1, 'true', 'yes'].include?(term.to_s.downcase))
120
122
  when :integer
121
123
  collection.public_send(sql_op, "#{column} = :term", term: term.gsub(/\D/, '').to_i)
122
124
  when :year
@@ -89,9 +89,9 @@ module Effective
89
89
  # https://github.com/rails/rails/issues/15331
90
90
  if collection_class.connection.respond_to?(:unprepared_statement)
91
91
  collection_sql = collection_class.connection.unprepared_statement { collection.to_sql }
92
- (collection_class.connection.execute("SELECT COUNT(*) FROM (#{collection_sql}) AS datatables_total_count").first['count'] rescue 1).to_i
92
+ (collection_class.connection.execute("SELECT COUNT(*) FROM (#{collection_sql}) AS datatables_total_count").first.values.first rescue 1).to_i
93
93
  else
94
- (collection_class.connection.execute("SELECT COUNT(*) FROM (#{collection.to_sql}) AS datatables_total_count").first['count'] rescue 1).to_i
94
+ (collection_class.connection.execute("SELECT COUNT(*) FROM (#{collection.to_sql}) AS datatables_total_count").first.values.first rescue 1).to_i
95
95
  end
96
96
  else
97
97
  collection.size
@@ -24,9 +24,9 @@ module Effective
24
24
  if collection_class.connection.respond_to?(:unprepared_statement)
25
25
  # https://github.com/rails/rails/issues/15331
26
26
  col_sql = collection_class.connection.unprepared_statement { col.to_sql }
27
- self.display_records = (collection_class.connection.execute("SELECT COUNT(*) FROM (#{col_sql}) AS datatables_filtered_count").first['count'] rescue 1).to_i
27
+ self.display_records = (collection_class.connection.execute("SELECT COUNT(*) FROM (#{col_sql}) AS datatables_filtered_count").first.values.first rescue 1).to_i
28
28
  else
29
- self.display_records = (collection_class.connection.execute("SELECT COUNT(*) FROM (#{col.to_sql}) AS datatables_filtered_count").first['count'] rescue 1).to_i
29
+ self.display_records = (collection_class.connection.execute("SELECT COUNT(*) FROM (#{col.to_sql}) AS datatables_filtered_count").first.values.first rescue 1).to_i
30
30
  end
31
31
  end
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '2.1.13'.freeze
2
+ VERSION = '2.1.14'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.13
4
+ version: 2.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect