explicit_activerecord 0.1.0 → 0.2.0
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 +4 -4
- data/README.md +8 -8
- data/lib/explicit_activerecord/no_db_access.rb +1 -1
- data/lib/explicit_activerecord.rb +1 -0
- metadata +31 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fed051d27a951002f71dd499cef812bd97b4e4e62ddfc819ba2bef791c98658f
|
4
|
+
data.tar.gz: f3b11237b4b2e90b72fd2c5fae9a95c069d007a2375b5b76f2a7879980a61062
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8676f04c92c9dc752b4998c000944d1e8021b50cd9fad176147c5c784c39e2710d10ff6f41fd9a893ea99d8da4b0b643eec598d7138cf2e427d1fc64f66d7faa
|
7
|
+
data.tar.gz: f9ff60de72bb7b1ef490faa1bb90469f69d118e4ef41458267ad1380dd20009882e312289edc0ada7d0757aa0faf6fba3c18af56db68ec0b9aa2dd9b47ddb13f
|
data/README.md
CHANGED
@@ -45,7 +45,7 @@ Once your model is configured correctly to use `ExplicitActiveRecord::Persistenc
|
|
45
45
|
### Incremental
|
46
46
|
`ExplicitActiveRecord::Persistence` is *incremental*. This means that you can include `ExplicitActiveRecord::Persistence`, and specify a *non-raising* behavior when the model is persisted implicitly, and use your logs or bug tracking system to find places where the model is implicitly raising, without breaking production. [See the `README` for `deprecation_helper` for more information on this](https://github.com/Gusto/deprecation_helper/blob/main/README.md).
|
47
47
|
|
48
|
-
### Usage
|
48
|
+
### Usage
|
49
49
|
The first step is to `include ExplicitActiveRecord::Persistence` in your models:
|
50
50
|
|
51
51
|
Secondly, you'll need to configure `dangerous_update_behaviors` (see the `deprecation_helper` gem for more info).
|
@@ -91,7 +91,7 @@ Note that you cannot pass in a relation to `with_explicit_persistence_for` — o
|
|
91
91
|
It is *not* recommended to use this dynamically, such as:
|
92
92
|
```ruby
|
93
93
|
# Don't do this!
|
94
|
-
self.class.
|
94
|
+
self.class.with_explicit_persistence_for(instance) do
|
95
95
|
instance.save!
|
96
96
|
end
|
97
97
|
```
|
@@ -102,23 +102,23 @@ You can specify multiple behaviors to invoke when the model is updated implicitl
|
|
102
102
|
|
103
103
|
Note that by default, `ExplicitActiveRecord` uses the global configuration for `DeprecationHelper`. If your project has already configured `DeprecationHelper`, using:
|
104
104
|
```ruby
|
105
|
-
DeprecationHelper.configure { |config| config.deprecation_strategies = [...] }
|
105
|
+
DeprecationHelper.configure { |config| config.deprecation_strategies = [...] }
|
106
106
|
```
|
107
107
|
then `ExplicitActiveRecord` will use the global configuration.
|
108
108
|
|
109
109
|
### How it works
|
110
|
-
When a client calls `my_model.save!` or `my_model.update!` without using the explicit persistence wrapper, `ExplicitActiveRecord::Persistence` will invoke `DeprecationHelper` with whatever deprecation strategies your model is configured with.
|
110
|
+
When a client calls `my_model.save!` or `my_model.update!` without using the explicit persistence wrapper, `ExplicitActiveRecord::Persistence` will invoke `DeprecationHelper` with whatever deprecation strategies your model is configured with.
|
111
111
|
|
112
112
|
|
113
|
-
## ExplicitActiveRecord::NoDbAccess
|
113
|
+
## ExplicitActiveRecord::NoDbAccess
|
114
114
|
`ExplicitActiveRecord::NoDbAccess` has a single public method to restrict the use of the database.
|
115
115
|
|
116
|
-
Once your class or module is configured correctly to use `ExplicitActiveRecord::NoDbAccess`, you will not be able to use the database within the `no_db_access` block.
|
116
|
+
Once your class or module is configured correctly to use `ExplicitActiveRecord::NoDbAccess`, you will not be able to use the database within the `no_db_access` block.
|
117
117
|
|
118
118
|
### Incremental
|
119
119
|
Note that unlike `ExplicitActiveRecord::Persistence`, `ExplicitActiveRecord::NoDbAccess` is NOT *incremental*. This means that using the DB within one of these blocks *will raise*. If you're interested in allowing `no_db_access` to behave like `Persistence`, please file an issue. It is recommended to use `NoDbAccess` in new code where you are very confident your code should not be using the DB.
|
120
120
|
|
121
|
-
### Usage
|
121
|
+
### Usage
|
122
122
|
The first step is to `include ExplicitActiveRecord::NoDbAccess` in your module or class.
|
123
123
|
|
124
124
|
Then, you can use the `no_db_access` block.
|
@@ -127,7 +127,7 @@ All together, this looks like this:
|
|
127
127
|
```ruby
|
128
128
|
class MyClass # can also be a module
|
129
129
|
include ExplicitActiveRecord::NoDbAccess
|
130
|
-
|
130
|
+
|
131
131
|
# Class method
|
132
132
|
def self.my_method
|
133
133
|
no_db_access do
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: explicit_activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Evanczuk
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.5.6293
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.5.6293
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: sorbet
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: sqlite3
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,21 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: tapioca
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description:
|
126
140
|
email:
|
127
141
|
- alex.evanczuk@gusto.com
|
128
142
|
executables: []
|
@@ -134,10 +148,11 @@ files:
|
|
134
148
|
- lib/explicit_activerecord.rb
|
135
149
|
- lib/explicit_activerecord/no_db_access.rb
|
136
150
|
- lib/explicit_activerecord/persistence.rb
|
137
|
-
homepage:
|
138
|
-
licenses:
|
151
|
+
homepage: https://github.com/Gusto/explicit_activerecord
|
152
|
+
licenses:
|
153
|
+
- MIT
|
139
154
|
metadata: {}
|
140
|
-
post_install_message:
|
155
|
+
post_install_message:
|
141
156
|
rdoc_options: []
|
142
157
|
require_paths:
|
143
158
|
- lib
|
@@ -145,15 +160,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
160
|
requirements:
|
146
161
|
- - ">="
|
147
162
|
- !ruby/object:Gem::Version
|
148
|
-
version: '0'
|
163
|
+
version: '3.0'
|
149
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
165
|
requirements:
|
151
166
|
- - ">="
|
152
167
|
- !ruby/object:Gem::Version
|
153
168
|
version: '0'
|
154
169
|
requirements: []
|
155
|
-
rubygems_version: 3.
|
156
|
-
signing_key:
|
170
|
+
rubygems_version: 3.4.19
|
171
|
+
signing_key:
|
157
172
|
specification_version: 4
|
158
173
|
summary: This is a gem for using ActiveRecord more explicitly.
|
159
174
|
test_files: []
|