acts_as_paranoid 0.7.1 → 0.7.2

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: '096b348280798fe5ac4770a6c57bdb0731d2c5df9e7d361551cf065fe71f0b56'
4
- data.tar.gz: 3d923644ebb1ccb3e06d9c04d8a0797f1677fcec880a188dd04ec8b19c9a957a
3
+ metadata.gz: 73cbdef60cb81f9506a3763c13b0380f83169b8c68f0b914305d828b90202d25
4
+ data.tar.gz: 2023f4db3125ff3db3dd9dc7b0fb0142e92d6f8f54bc433557d5dd0dc40fb853
5
5
  SHA512:
6
- metadata.gz: e677d8e734d9c6d72fd68feaad170f928fb159ea6a90e400632ce8365f8120a991eae46508bb04d641117fa2e24d3e38e9df6699c1d70b2cd994a4cf85c49379
7
- data.tar.gz: b58a42cbf60696baffac255deb673476e5e339dbbe4bd1681959442ca2fc33a51f6d2e146755fc8f79539976d47c6244927969c82a86fdb70a553de44281e512
6
+ metadata.gz: 1c7b2ff7d8655621915c11630012ff946a196b46fd0a175facad75d90aa4f6ecae1ae6df1e627f9cf778faa46d26fb559b275e62101a4ba402007d545014f43d
7
+ data.tar.gz: ec47e5232127609e3e83b9bf22b142a821e955b55a77e082f21ceaeb5e62c390253fee6815cfc3a4a795257eb68c15f29eb5adbad8e511703718e4278d84e52c
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.7.2
6
+
7
+ * Do not set boolean column to NULL on recovery if nulls are not allowed
8
+ ([#193], by [Shodai Suzuki][soartec-lab])
9
+ * Add a CONTRIBUTING.md file ([#207], by [Matijs van Zuijlen][mvz])
10
+
5
11
  ## 0.7.1
6
12
 
7
13
  * Support Rails 6.1 ([#191], by [Matijs van Zuijlen][mvz])
@@ -87,6 +93,7 @@ Notable changes to this project will be documented in this file.
87
93
  [ri4a]: https://github.com/ri4a
88
94
  [pauldruziak]: https://github.com/pauldruziak
89
95
  [shadydealer]: https://github.com/shadydealer
96
+ [soartec-lab]: https://github.com/soartec-lab
90
97
  [thebravoman]: https://github.com/thebravoman
91
98
  [valeriecodes]: https://github.com/valeriecodes
92
99
  [wtfspm]: https://github.com/wtfspm
@@ -95,6 +102,8 @@ Notable changes to this project will be documented in this file.
95
102
 
96
103
  [#209]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/209
97
104
  [#208]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/208
105
+ [#207]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/207
106
+ [#193]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/193
98
107
  [#191]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/191
99
108
  [#175]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/175
100
109
  [#173]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/173
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,59 @@
1
+ # Contributing to ActsAsParanoid
2
+
3
+ We welcome all contributions to ActsAsParanoid. Below are some guidelines to
4
+ help the process of handling issues and pull requests go smoothly.
5
+
6
+ ## Issues
7
+
8
+ When creating an issue, please try to provide as much information as possible.
9
+ Also, please follow the guidelines below to make it easier for us to figure out
10
+ what's going on. If you miss any of these points we will probably ask you to
11
+ improve the ticket.
12
+
13
+ - Include a clear title describing the problem
14
+ - Describe what you are trying to achieve
15
+ - Describe what you did, preferably including relevant code
16
+ - Describe what you expected to happen
17
+ - Describe what happened instead, possibly including relevant output
18
+ - Use [code blocks](https://github.github.com/gfm/#fenced-code-blocks) to
19
+ format any code and output in your ticket to make it readable.
20
+
21
+ ## Pull requests
22
+
23
+ If you have an idea for a particular feature, it's probably best to create a
24
+ GitHub issue for it before trying to implement it yourself. That way, we can
25
+ discuss the feature and whether it makes sense to include in ActsAsParanoid itself
26
+ before putting in the work to implement it.
27
+
28
+ If you want to send pull requests or patches, try to follow the instructions
29
+ below. **If you get stuck, please make a pull request anyway and we'll try to
30
+ help out.**
31
+
32
+ - Make sure `rake test` runs without reporting any failures.
33
+ - Add tests for your feature. Otherwise, we can't see if it works or if we
34
+ break it later.
35
+ - Make sure latest master merges cleanly with your branch. Things might
36
+ have moved around since you forked.
37
+ - Try not to include changes that are irrelevant to your feature in the
38
+ same commit.
39
+ - Keep an eye on the build results in GitHub Actions. If the build fails and it
40
+ seems due to your changes, please update your pull request with a fix.
41
+
42
+ ### The review process
43
+
44
+ - We will try to review your pull request as soon as possible but we can make no
45
+ guarantees. Feel free to ping us now and again.
46
+ - We will probably ask you to rebase your branch on current master at some point
47
+ during the review process.
48
+ If you are unsure how to do this,
49
+ [this in-depth guide](https://git-rebase.io/) should help out.
50
+ - If you have any unclear commit messages, work-in-progress commits, or commits
51
+ that just fix a mistake in a previous commits, we will ask you to clean up
52
+ the history.
53
+ Again, [the git-rebase guide](https://git-rebase.io/) should help out.
54
+ - At the end of the review process we may still choose not to merge your pull
55
+ request. For example, this could happen if we decide the proposed feature
56
+ should not be part of ActsAsParanoid, or if the technical implementation does not
57
+ match where we want to go with the architecture the project.
58
+ - We will generally not merge any pull requests that make the build fail, unless
59
+ it's very clearly not related to the changes in the pull request.
@@ -32,8 +32,12 @@ module ActsAsParanoid
32
32
  }
33
33
  if options[:column_type] == "string"
34
34
  paranoid_configuration.merge!(deleted_value: "deleted")
35
+ elsif options[:column_type] == "boolean" && !options[:allow_nulls]
36
+ paranoid_configuration.merge!(recovery_value: false)
37
+ elsif options[:column_type] == "boolean"
38
+ paranoid_configuration.merge!(allow_nulls: true)
35
39
  end
36
- paranoid_configuration.merge!(allow_nulls: true) if options[:column_type] == "boolean"
40
+
37
41
  paranoid_configuration.merge!(options) # user options
38
42
 
39
43
  unless %w[time boolean string].include? paranoid_configuration[:column_type]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActsAsParanoid
4
- VERSION = "0.7.1"
4
+ VERSION = "0.7.2"
5
5
  end
data/test/test_core.rb CHANGED
@@ -533,6 +533,24 @@ class ParanoidTest < ParanoidBaseTest
533
533
  assert_equal 0, ParanoidBooleanNotNullable.with_deleted.where(id: ps).count
534
534
  end
535
535
 
536
+ def test_boolean_type_with_no_nil_value_after_recover
537
+ ps = ParanoidBooleanNotNullable.create!
538
+ ps.destroy
539
+ assert_equal 1, ParanoidBooleanNotNullable.only_deleted.where(id: ps).count
540
+
541
+ ps.recover
542
+ assert_equal 1, ParanoidBooleanNotNullable.where(id: ps).count
543
+ end
544
+
545
+ def test_boolean_type_with_no_nil_value_after_recover!
546
+ ps = ParanoidBooleanNotNullable.create!
547
+ ps.destroy
548
+ assert_equal 1, ParanoidBooleanNotNullable.only_deleted.where(id: ps).count
549
+
550
+ ps.recover!
551
+ assert_equal 1, ParanoidBooleanNotNullable.where(id: ps).count
552
+ end
553
+
536
554
  def test_no_double_tap_destroys_fully
537
555
  ps = ParanoidNoDoubleTapDestroysFully.create!
538
556
  2.times { ps.destroy }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_paranoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Scott
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-03-14 00:00:00.000000000 Z
13
+ date: 2021-04-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -148,14 +148,14 @@ dependencies:
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: 1.11.0
151
+ version: 1.12.0
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: 1.11.0
158
+ version: 1.12.0
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: simplecov
161
161
  requirement: !ruby/object:Gem::Requirement
@@ -184,6 +184,7 @@ extensions: []
184
184
  extra_rdoc_files: []
185
185
  files:
186
186
  - CHANGELOG.md
187
+ - CONTRIBUTING.md
187
188
  - LICENSE
188
189
  - README.md
189
190
  - lib/acts_as_paranoid.rb