arsi 1.1.0 → 1.1.1
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 +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b528e9d79cdc0d21f70a93d39d631f2ad72f239eda03ea6d40a249ba85f00d81
|
4
|
+
data.tar.gz: 9fa5461a0c90bc0efbc3a85d2adaf913ca147425b83e378ed0c34c7ecf829da5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5646db280bf628a6e75a1dffa57794a64a2ffbd2ff18942b04aec3fa35eaa9c7b8ccf4040078295404542d5c19fc391d01bc4ba1ab7af058c85cb3cddf75bcb
|
7
|
+
data.tar.gz: be068e843094617e04279a4917e802a047f88f6ada372604a1e5c2dee1d7c7b790c65a71662c56ea817aeaf74602234182254908615208c49de008743de4b237
|
@@ -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.1.
|
4
|
+
version: 1.1.1
|
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: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|
@@ -30,7 +30,7 @@ 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
36
|
version: '7.1'
|
@@ -40,7 +40,7 @@ dependencies:
|
|
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
46
|
version: '7.1'
|
@@ -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.3.
|
150
|
-
signing_key:
|
150
|
+
rubygems_version: 3.0.3.1
|
151
|
+
signing_key:
|
151
152
|
specification_version: 4
|
152
153
|
summary: ActiveRecord SQL Inspector
|
153
154
|
test_files: []
|