ahoy_matey 5.2.0 → 5.2.1

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: 9161dead45561a928523eb7d5ed70be20c67c8629499c35cb428271d714895a7
4
- data.tar.gz: f17eb958ee297a4eda86388e0458a04a2a39de5b868076521eb65dd6e4cbc21a
3
+ metadata.gz: 5ebbbd60be1beec66d70d5fee4922f013e61a9add9b9da33ec709fa8ca166cf7
4
+ data.tar.gz: '0969a3b0711ccc95e140017fc81480c2636a819b113b5a09337f72ff19b2fb09'
5
5
  SHA512:
6
- metadata.gz: c68fa7030244573a75b72167d163a8a0f2cfb5ef01e3718980ea25e5c13a5936973d0d5f83d3302f9e610508d94758ec0587f6fe4dd19c7c23668181ea1dcfe0
7
- data.tar.gz: 7950a3cd2dda3818e21a6da37ab0d1b49b01d22110c76f0ae1abd15abba7aaa6140db24d70cedb4d5af0c5022f2b95a2f7e5a11339425eefb51240bb9ea17578
6
+ metadata.gz: 6ef517cd3e3eb8b612ae54aef6b9051d1533acc0562303e03e8656b04b703425b55b0d4b6b0811c4f420c46ad6f34e6c01d2fc2dd802438f5dbbee36f82b4118
7
+ data.tar.gz: 228810c7e621654f88a21f864fd1400f0226fd9efb0d1902ffc98f997c9263daad675f656c59de2e28f5f641f2f70ed99e7814d071062610309a19f8724f4bc9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 5.2.1 (2024-10-07)
2
+
3
+ - Fixed connection leasing for Active Record 7.2+
4
+
1
5
  ## 5.2.0 (2024-09-04)
2
6
 
3
7
  - Improved error handling for invalid API parameters
@@ -10,13 +10,13 @@ module Ahoy
10
10
  def where_props(properties)
11
11
  return all if properties.empty?
12
12
 
13
- adapter_name = respond_to?(:connection) ? connection.adapter_name.downcase : "mongoid"
13
+ adapter_name = respond_to?(:connection_db_config) ? connection_db_config.adapter.to_s : "mongoid"
14
14
  case adapter_name
15
15
  when "mongoid"
16
16
  where(properties.to_h { |k, v| ["properties.#{k}", v] })
17
- when /mysql|trilogy/
17
+ when /mysql|trilogy/i
18
18
  where("JSON_CONTAINS(properties, ?, '$') = 1", properties.to_json)
19
- when /postgres|postgis/
19
+ when /postg/i
20
20
  case columns_hash["properties"].type
21
21
  when :hstore
22
22
  properties.inject(all) do |relation, (k, v)|
@@ -31,7 +31,7 @@ module Ahoy
31
31
  else
32
32
  where("properties::jsonb @> ?", properties.to_json)
33
33
  end
34
- when /sqlite/
34
+ when /sqlite/i
35
35
  properties.inject(all) do |relation, (k, v)|
36
36
  if v.nil?
37
37
  relation.where("JSON_EXTRACT(properties, ?) IS NULL", "$.#{k}")
@@ -50,16 +50,16 @@ module Ahoy
50
50
  props.flatten!
51
51
 
52
52
  relation = all
53
- adapter_name = respond_to?(:connection) ? connection.adapter_name.downcase : "mongoid"
53
+ adapter_name = respond_to?(:connection_db_config) ? connection_db_config.adapter.to_s : "mongoid"
54
54
  case adapter_name
55
55
  when "mongoid"
56
56
  raise "Adapter not supported: #{adapter_name}"
57
- when /mysql|trilogy/
57
+ when /mysql|trilogy/i
58
58
  props.each do |prop|
59
- quoted_prop = connection.quote("$.#{prop}")
59
+ quoted_prop = connection_pool.with_connection { |c| c.quote("$.#{prop}") }
60
60
  relation = relation.group("JSON_UNQUOTE(JSON_EXTRACT(properties, #{quoted_prop}))")
61
61
  end
62
- when /postgres|postgis/
62
+ when /postg/i
63
63
  # convert to jsonb to fix
64
64
  # could not identify an equality operator for type json
65
65
  # and for text columns
@@ -67,12 +67,12 @@ module Ahoy
67
67
  cast = [:jsonb, :hstore].include?(column_type) ? "" : "::jsonb"
68
68
 
69
69
  props.each do |prop|
70
- quoted_prop = connection.quote(prop)
70
+ quoted_prop = connection_pool.with_connection { |c| c.quote(prop) }
71
71
  relation = relation.group("properties#{cast} -> #{quoted_prop}")
72
72
  end
73
- when /sqlite/
73
+ when /sqlite/i
74
74
  props.each do |prop|
75
- quoted_prop = connection.quote("$.#{prop}")
75
+ quoted_prop = connection_pool.with_connection { |c| c.quote("$.#{prop}") }
76
76
  relation = relation.group("JSON_EXTRACT(properties, #{quoted_prop})")
77
77
  end
78
78
  else
data/lib/ahoy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ahoy
2
- VERSION = "5.2.0"
2
+ VERSION = "5.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahoy_matey
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-05 00:00:00.000000000 Z
11
+ date: 2024-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.5.11
115
+ rubygems_version: 3.5.16
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: Simple, powerful, first-party analytics for Rails