active_record-comments 0.6.0 → 0.8.0

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: 155747a2b7351da88fd82efe5a24efd1e4d0a7982316d9dcd7838cdbc6926560
4
- data.tar.gz: f54706401737ea0e6967b61eb889045e9ecb0a8c1ce36a6f9856594b66d84bba
3
+ metadata.gz: 2f3d063aaa596c171fa3fa92e31be8745f38c880310ca51afc9a32d8db64b7c9
4
+ data.tar.gz: 9b1c2ae2bb85a846e690ac0f8e08fa032795cc9ccce090b55c94e85158909f95
5
5
  SHA512:
6
- metadata.gz: 2c8a7cb8875e6aec22a3f5d206c76f756efdf53cd448cff0c10ead98fec4881b8df6a899d1f7908a1c9c955c192142d5c67314db5e6570013abac5f59a42cdc0
7
- data.tar.gz: 7b6372e72ec6c2f9d2bdda3a8570db89f683c3cb2e1dee2c8dcb1b2b22f9b66f3355b65dcadf20f81944077270a691050ca6f0d855d87d1c4e0febce109a11a9
6
+ metadata.gz: b1eafcfa480e6dd6dd4c69cc6cbe81bc11828a27f0c49ec49fe001f8e0b8baf276e26b753385473e7823243a3736a9a212e418158e90411e73baf941edc516f5
7
+ data.tar.gz: ea2f8d1591d25617513aa1aeb84903ff38e8bd6f85fc07c5eea28e73126deeb3de8ee3973d1a0ef8a3c84b6c0017451c53491d5ebfb1fc92d003528a772e6fac
@@ -4,15 +4,20 @@ module ActiveRecord
4
4
  class << self
5
5
  def included(base)
6
6
  base.class_eval do
7
+ # ActiveRecord 7.1
8
+ if base.method_defined?(:internal_exec_query)
9
+ alias_method :exec_query_without_comment, :internal_exec_query
10
+ def internal_exec_query(query, *args, **kwargs, &block)
11
+ query = ActiveRecord::Comments.with_comment_sql(query)
12
+ exec_query_without_comment(query, *args, **kwargs, &block)
13
+ end
7
14
  # ActiveRecord 3.2 vs sqlite, maybe others ...
8
- if base.method_defined?(:exec_query)
15
+ elsif base.method_defined?(:exec_query)
9
16
  alias_method :exec_query_without_comment, :exec_query
10
- def exec_query(query, *args, prepare: false, &block)
17
+ def exec_query(query, *args, **kwargs, &block)
11
18
  query = ActiveRecord::Comments.with_comment_sql(query)
12
- exec_query_without_comment(query, *args, prepare: prepare, &block)
19
+ exec_query_without_comment(query, *args, **kwargs, &block)
13
20
  end
14
-
15
- # 99% case
16
21
  elsif base.method_defined?(:execute)
17
22
  alias_method :execute_without_comment, :execute
18
23
  def execute(query, *args, &block)
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Comments
3
- VERSION = "0.6.0"
3
+ VERSION = "0.8.0"
4
4
  end
5
5
  end
@@ -28,7 +28,6 @@ module ActiveRecord
28
28
  end
29
29
  end
30
30
 
31
- private
32
31
  def current_comments
33
32
  Thread.current[:ar_comments] ||= []
34
33
  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: 0.6.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-16 00:00:00.000000000 Z
11
+ date: 2024-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.1'
22
+ version: '7.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.1'
32
+ version: '7.2'
33
33
  description:
34
34
  email: michael@grosser.it
35
35
  executables: []