has_archive 0.5.1 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38cc5a457d2da5ffda7a319bad65b77ac1e3023b
4
- data.tar.gz: 6ffeec1f66e661571bddf5657d2084701f5f9fc7
3
+ metadata.gz: 37cfd5c4c46c323fba99e5147cf4d4137460d54e
4
+ data.tar.gz: 794037a636277907d47142b0b24bada2f3886c9e
5
5
  SHA512:
6
- metadata.gz: a2bb7dd9ffd44e68a9f7d0eb5368d5d51af1789b8953a6e0a66df8dd563176f7f02ca6fb0c5b48802ffb773f6df5023f900ec49e8de7a2ca858551c039d4424a
7
- data.tar.gz: 8d8646be70987556922b03f368ceb42ecfaff6ee8abaa28ce311f9490d23f3a8626282bab31c79450e4b6b20523869b89eaf12fbb89bf2c0acd8c222b368a896
6
+ metadata.gz: 47580cadf290b2b5f9a2851c08303fc70d4ad3f7561e9aaf5b10b96e41d824d97199cb69f7653e9e58afb7570ed8b5e6c51deb5433f4d84846cb65f354b64ac6
7
+ data.tar.gz: 809d713b26f8c50ace80e309eb24c6ce5a3169bfbd5cf313e18f62bf17f1b917735ba01ad537849ea58d58f49bc1be4a38d2280d78589dae372bc29134e99e22
@@ -31,7 +31,9 @@ module HasArchive
31
31
 
32
32
  module InstanceMethods
33
33
  def archive(force: false)
34
- archive = self.class::Archive.new(self.attributes)
34
+ attrs = self.attributes
35
+ attrs['original_id'] = attrs.delete('id')
36
+ archive = self.class::Archive.new(attrs)
35
37
  archive.archived_at = Time.now
36
38
  archive.save(validate: false)
37
39
  self.destroy(for_real: true)
@@ -12,6 +12,7 @@ class CreateArchiveFor#{@table_name.camelize} < ActiveRecord::Migration
12
12
  def change
13
13
  create_table :#{@table_name.singularize}_archives do |t|
14
14
  #{columns.map {|c| build_column(c) }.join("\n") }
15
+ t.integer :original_id, null: false
15
16
  t.datetime :archived_at, null: false
16
17
  end
17
18
 
@@ -1,3 +1,3 @@
1
1
  module HasArchive
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_archive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Morris
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-01 00:00:00.000000000 Z
11
+ date: 2017-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler