arsi 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arsi/persistence.rb +26 -0
- data/lib/arsi/relation.rb +0 -4
- data/lib/arsi/version.rb +1 -1
- data/lib/arsi.rb +7 -4
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '04585a86dca82137d81328ec9453cb61298cfa831234083bf467b5a0f9e733dd'
|
4
|
+
data.tar.gz: 7cc4b0295946f8d237abf9ddf16f670b2938230c403ce016848664dfdb29e5ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 584ad36adb820158ecac67185b2bccd281e0278fa1e0fa28059c0200250402158882e20f1b351e700a22d6efb7d0aff1af293268efa3fe6545955beb1649283a
|
7
|
+
data.tar.gz: cd73d592774bd94727fe519e0205cc30be7e637e4dcc84037568cd9821808be819de2c16c115c8cde26184bf861d1457706ae1c9bcd2470dd09dbff677498c1f
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Arsi
|
2
|
+
module Persistence
|
3
|
+
def self.prepended(klass)
|
4
|
+
klass.singleton_class.prepend(ClassMethods)
|
5
|
+
end
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
def _update_record(*)
|
9
|
+
with_relation_in_connection { super }
|
10
|
+
end
|
11
|
+
|
12
|
+
def _delete_record(*)
|
13
|
+
with_relation_in_connection { super }
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def with_relation_in_connection
|
19
|
+
connection.arsi_relation = self.unscoped
|
20
|
+
yield
|
21
|
+
ensure
|
22
|
+
connection.arsi_relation = nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/arsi/relation.rb
CHANGED
data/lib/arsi/version.rb
CHANGED
data/lib/arsi.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'arsi/arel_tree_manager'
|
2
2
|
require 'arsi/mysql2_adapter'
|
3
|
+
require 'arsi/persistence'
|
3
4
|
require 'arsi/relation'
|
4
5
|
require 'active_record'
|
5
6
|
require 'active_record/connection_adapters/mysql2_adapter'
|
@@ -9,6 +10,7 @@ module Arsi
|
|
9
10
|
Arel::UpdateManager.include(ArelTreeManager)
|
10
11
|
Arel::DeleteManager.include(ArelTreeManager)
|
11
12
|
ActiveRecord::ConnectionAdapters::Mysql2Adapter.prepend(Mysql2Adapter)
|
13
|
+
ActiveRecord::Base.prepend(Persistence)
|
12
14
|
ActiveRecord::Relation.prepend(Relation)
|
13
15
|
ActiveRecord::Querying.delegate(:without_arsi, :to => :relation)
|
14
16
|
|
@@ -53,10 +55,11 @@ module Arsi
|
|
53
55
|
private
|
54
56
|
|
55
57
|
def arel_where_sql(arel, relation)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
58
|
+
if relation.nil?
|
59
|
+
arel.where_sql
|
60
|
+
else
|
61
|
+
arel.where_sql(relation.model)
|
62
|
+
end
|
60
63
|
end
|
61
64
|
|
62
65
|
def sql_check!(sql, relation)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arsi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Kintner
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|
@@ -30,20 +30,20 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 5.
|
33
|
+
version: 5.2.0
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '7.
|
36
|
+
version: '7.2'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 5.
|
43
|
+
version: 5.2.0
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '7.
|
46
|
+
version: '7.2'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bump
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,13 +125,14 @@ files:
|
|
125
125
|
- lib/arsi.rb
|
126
126
|
- lib/arsi/arel_tree_manager.rb
|
127
127
|
- lib/arsi/mysql2_adapter.rb
|
128
|
+
- lib/arsi/persistence.rb
|
128
129
|
- lib/arsi/relation.rb
|
129
130
|
- lib/arsi/version.rb
|
130
131
|
homepage: https://github.com/zendesk/arsi
|
131
132
|
licenses:
|
132
133
|
- Apache License Version 2.0
|
133
134
|
metadata: {}
|
134
|
-
post_install_message:
|
135
|
+
post_install_message:
|
135
136
|
rdoc_options: []
|
136
137
|
require_paths:
|
137
138
|
- lib
|
@@ -139,15 +140,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
140
|
requirements:
|
140
141
|
- - ">="
|
141
142
|
- !ruby/object:Gem::Version
|
142
|
-
version: 2.
|
143
|
+
version: 2.7.0
|
143
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
145
|
requirements:
|
145
146
|
- - ">="
|
146
147
|
- !ruby/object:Gem::Version
|
147
148
|
version: '0'
|
148
149
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
150
|
-
signing_key:
|
150
|
+
rubygems_version: 3.5.9
|
151
|
+
signing_key:
|
151
152
|
specification_version: 4
|
152
153
|
summary: ActiveRecord SQL Inspector
|
153
154
|
test_files: []
|