active_archive 6.0.0 → 6.0.1
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/.rubocop.yml +1 -1
- data/.travis.yml +10 -10
- data/README.md +11 -2
- data/lib/active_archive/base.rb +2 -0
- data/lib/active_archive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bbfa9b4c8c5cd87c6ff40b24b518b98577b87fd29004743a2afc78f7652518f
|
4
|
+
data.tar.gz: e28cfa87887246ca30a40030a4d0dbbbf7e93feabdaf17a42beba92fd9d98920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fdcf813a2d5de19baac112173e3e54c8ec0c4189000a088535d887e42472de12c5fb0f063d29d22985a2c6000c8ad578119041f9b0c076d266229640ee99362
|
7
|
+
data.tar.gz: c973b47fb5654d137c070ab6f91efcb7baa4328d555097cffc25a4aad35931aac7f64bbd29fd0498f19b631c19b42f7751146b50ff1ca4fb38ffcaf984f2092d
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
|
2
|
-
- sudo apt-get install libxml2-dev
|
3
|
-
cache: bundler
|
1
|
+
sudo: false
|
4
2
|
language: ruby
|
5
|
-
notifications:
|
6
|
-
email:
|
7
|
-
recipients:
|
8
|
-
- j.gomez@drexed.com
|
9
|
-
on_failure: change
|
10
|
-
on_success: never
|
11
3
|
rvm:
|
12
4
|
- ruby-head
|
13
|
-
|
5
|
+
before_install:
|
6
|
+
- sudo apt-get install libxml2-dev
|
7
|
+
- gem update --system
|
8
|
+
- gem install bundler
|
9
|
+
- bundle install
|
10
|
+
script:
|
11
|
+
- bundle exec rake
|
12
|
+
notifications:
|
13
|
+
disable: true
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
ActiveArchive is a library for preventing database records from being destroyed.
|
7
7
|
|
8
|
-
**NOTE: version >= '6.0.0' has a
|
8
|
+
**NOTE: version >= '6.0.0' has a breaking change with the migration timestamps, initializer options, and model/record callbacks.**
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -29,10 +29,11 @@ Or install it yourself as:
|
|
29
29
|
* [Usage](#usage)
|
30
30
|
* [Methods](#methods)
|
31
31
|
* [Scopes](#scopes)
|
32
|
+
* [Callbacks](#callbacks)
|
32
33
|
|
33
34
|
## Configurations
|
34
35
|
|
35
|
-
`rails
|
36
|
+
`rails g active_archive:install` will generate the following file:
|
36
37
|
`../config/initalizers/active_archive.rb`
|
37
38
|
|
38
39
|
```ruby
|
@@ -91,6 +92,14 @@ User.archived.all #=> returns only archived record
|
|
91
92
|
User.unarchived.all #=> returns only unarchived record
|
92
93
|
```
|
93
94
|
|
95
|
+
## Callbacks
|
96
|
+
|
97
|
+
**Options:**
|
98
|
+
* `before_archive`
|
99
|
+
* `before_unarchived`
|
100
|
+
* `after_archive`
|
101
|
+
* `after_unarchive`
|
102
|
+
|
94
103
|
## Contributing
|
95
104
|
|
96
105
|
Your contribution is welcome.
|
data/lib/active_archive/base.rb
CHANGED
@@ -83,6 +83,7 @@ module ActiveArchive
|
|
83
83
|
save(validate: false)
|
84
84
|
end
|
85
85
|
|
86
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
86
87
|
def mark_relections_as_archived
|
87
88
|
self.class.reflections.each do |table_name, reflection|
|
88
89
|
next unless dependent_destroy?(reflection)
|
@@ -100,6 +101,7 @@ module ActiveArchive
|
|
100
101
|
dependents.send(action)
|
101
102
|
end
|
102
103
|
end
|
104
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
103
105
|
|
104
106
|
def mark_relections_as_unarchived
|
105
107
|
self.class.reflections.each do |table_name, reflection|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_archive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|