active_record-comments 1.1.0 → 1.1.1

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
  SHA256:
3
- metadata.gz: eb953c9e84e5eda78d22750cd3326237b8c8636d389c3fdc0752a6855d79b172
4
- data.tar.gz: 2f5b1b24920f261f3be90ff1ad60af32dcd76cab2337ccd1b603dccab7e50f65
3
+ metadata.gz: 1ebb348d2ac167aa5d2caf6bed63f158dd18a7f3d15dee7938575a6b927ea688
4
+ data.tar.gz: 9d4620a2343c79d922f398092dce0d07a925232734245e37f3333b9a86d972b3
5
5
  SHA512:
6
- metadata.gz: ff820e23eb5785b63d3dc1b144d6c185b6237953b9fabca1b037d3deabda95352b966f144259cfb0850e1cec3f6c22e0ad7bc57e7e32436197e6aca452cb522e
7
- data.tar.gz: 13fd57e87378f9e1a61650e075fcbdb979cf5dd554ccccd7b54e74321bddf29783d36cf9db6ba3b5976be80f05d63c6f3743ce40de15dd64f6fc695f3de79942
6
+ metadata.gz: d1836b9c02f042585d08876707e2802874e36e771b4e62f141b50ed17c179c5a0cd1a67a8c6dde90a67a2ff556c1c8a70b4aa82c1b432f29ab7184935493095a
7
+ data.tar.gz: '08af0f49517f7b771d56fd0604074a217220bcbcc360ef06ba46e2c9a10686c0ee2f99d1bc0dfdbda76bd2a34ce29ebf9ab9223a2f9cef557c0ef77b823df2f2'
@@ -4,22 +4,8 @@ module ActiveRecord
4
4
  class << self
5
5
  def included(base)
6
6
  base.class_eval do
7
- # ActiveRecord 8.2
8
- if defined?(ActiveRecord::ConnectionAdapters::QueryIntent)
9
- alias_method :raw_execute_without_comment, :raw_execute
10
- def raw_execute(intent)
11
- compile_arel_in_intent(intent)
12
-
13
- if (sql = intent.processed_sql)
14
- intent.processed_sql = ActiveRecord::Comments.with_comment_sql(sql)
15
- elsif (sql = intent.raw_sql)
16
- intent.raw_sql = ActiveRecord::Comments.with_comment_sql(sql)
17
- end
18
-
19
- raw_execute_without_comment(intent)
20
- end
21
7
  # ActiveRecord 7.1
22
- elsif base.method_defined?(:internal_exec_query)
8
+ if base.method_defined?(:internal_exec_query)
23
9
  alias_method :internal_exec_query_without_comment, :internal_exec_query
24
10
  def internal_exec_query(query, *args, **kwargs, &block)
25
11
  query = ActiveRecord::Comments.with_comment_sql(query)
@@ -71,5 +57,12 @@ module ActiveRecord
71
57
  end
72
58
  end
73
59
  end
60
+
61
+ module ExecuteIntentWithComments
62
+ def execute!
63
+ @processed_sql = ::ActiveRecord::Comments.with_comment_sql(processed_sql)
64
+ super
65
+ end
66
+ end
74
67
  end
75
68
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Comments
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
@@ -39,4 +39,10 @@ module ActiveRecord
39
39
  end
40
40
  end
41
41
 
42
- ActiveRecord::Comments::ExecuteWithComments.install!
42
+ if defined?(ActiveRecord::ConnectionAdapters::QueryIntent)
43
+ # Rails 8.2
44
+ ActiveRecord::ConnectionAdapters::QueryIntent.prepend(::ActiveRecord::Comments::ExecuteIntentWithComments)
45
+ else
46
+ # Rails 8.1 and older
47
+ ActiveRecord::Comments::ExecuteWithComments.install!
48
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record-comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-11-17 00:00:00.000000000 Z
11
+ date: 2025-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord