active_archive 1.0.0 → 2.0.0

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
  SHA1:
3
- metadata.gz: 92531b5d862df3442eb6af8204caed114bca14fb
4
- data.tar.gz: 43994d4a91dd6108160ff7bd30f098116414d14b
3
+ metadata.gz: e158692b2725211de2ba8c52ada0675633373507
4
+ data.tar.gz: d013e8165bd6a583a2180ee941b21955c97e01d0
5
5
  SHA512:
6
- metadata.gz: ec94e3a4b2ea0990e72dde146a339c1894d6ba22e7b761b91a21597db0bc246a66c86f986e4eba22c8d645c52d49d8e92f2e5ea7eb8a71f0586876c10c4a3e53
7
- data.tar.gz: b1bbbb8347d054ec27bac5eb4b2ea0fffa9af076371207fda8437234da95d60693866c9cb4387cbbf0bf844e8c6087727127d687d29eb941014ef84d1cef475e
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
 
@@ -0,0 +1,5 @@
1
+ en:
2
+ active_archive:
3
+ archival:
4
+ archived: "Archived"
5
+ unarchived: "Unarchived"
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ActiveArchive
2
- VERSION = "1.0.0"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -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: 1.0.0
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-14 00:00:00.000000000 Z
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