active_archive 1.0.0 → 2.0.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 +2 -0
- data/config/locales/en.yml +5 -0
- data/lib/active_archive/base.rb +7 -0
- data/lib/active_archive/version.rb +1 -1
- data/lib/active_archive.rb +25 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e158692b2725211de2ba8c52ada0675633373507
|
4
|
+
data.tar.gz: d013e8165bd6a583a2180ee941b21955c97e01d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebc6c31649e47dea958f7942de7cf6141e6ecedf85427a73e1670f8d3b42d87fd302a90a3138f606dd63dd0f4526654f8294756494242d5c5641f05328f9acac
|
7
|
+
data.tar.gz: 482ae6a55ff1487ed27b3d5f2aae329cfb386b51e4013e5b2be9e99daed4337928cd167b4bcc6595dd236caa296d62002ab949a1eafd50538b033392ddf45aa7
|
data/README.md
CHANGED
@@ -60,6 +60,8 @@ User.first.destroy #=> archives User record and dependents
|
|
60
60
|
User.first.delete #=> deletes User record and dependents
|
61
61
|
User.first.unarchive #=> unarchives User record and dependents
|
62
62
|
|
63
|
+
User.first.to_archival #=> returns archival state string
|
64
|
+
|
63
65
|
User.first.archive(:force) #=> destroys User record and dependents
|
64
66
|
User.first.destroy(:force) #=> destroys User record and dependents
|
65
67
|
|
data/lib/active_archive/base.rb
CHANGED
@@ -31,6 +31,11 @@ module ActiveArchive
|
|
31
31
|
end
|
32
32
|
|
33
33
|
alias_method(:archive, :destroy)
|
34
|
+
alias_method(:archive!, :destroy)
|
35
|
+
|
36
|
+
def to_archival
|
37
|
+
I18n.t("active_archive.archival.#{archived? ? :archived : :unarchived}")
|
38
|
+
end
|
34
39
|
|
35
40
|
def unarchive(validate=nil)
|
36
41
|
with_transaction_returning_status do
|
@@ -39,6 +44,8 @@ module ActiveArchive
|
|
39
44
|
end
|
40
45
|
end
|
41
46
|
|
47
|
+
alias_method(:unarchive!, :unarchive)
|
48
|
+
|
42
49
|
def unarchived?
|
43
50
|
!archived?
|
44
51
|
end
|
data/lib/active_archive.rb
CHANGED
@@ -25,4 +25,28 @@ module ActiveArchive
|
|
25
25
|
|
26
26
|
end
|
27
27
|
|
28
|
-
ActiveRecord::Base.send(:include, ActiveArchive::Base)
|
28
|
+
ActiveRecord::Base.send(:include, ActiveArchive::Base)
|
29
|
+
|
30
|
+
if defined?(Rails)
|
31
|
+
require 'rails'
|
32
|
+
|
33
|
+
module ActiveArchive
|
34
|
+
class Railtie < ::Rails::Railtie
|
35
|
+
|
36
|
+
initializer 'active_archive' do |app|
|
37
|
+
ActiveArchive::Railtie.instance_eval do
|
38
|
+
[app.config.i18n.available_locales].each do |locale|
|
39
|
+
(I18n.load_path << path(locale)) if File.file?(path(locale))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
protected
|
45
|
+
|
46
|
+
def self.path(locale)
|
47
|
+
File.expand_path("../../config/locales/#{locale}.yml", __FILE__)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- bin/console
|
142
142
|
- bin/rake
|
143
143
|
- bin/setup
|
144
|
+
- config/locales/en.yml
|
144
145
|
- lib/active_archive.rb
|
145
146
|
- lib/active_archive/base.rb
|
146
147
|
- lib/active_archive/configuration.rb
|