snapshotable 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/snapshotable/model.rb +6 -3
- data/lib/snapshotable/model_config.rb +3 -4
- data/lib/snapshotable/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6de38e7ae9020d6c1bd962cf5251f86cd393ea92
|
4
|
+
data.tar.gz: 48d422d6c78f0e6b02bd32905a399be113fd069d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adc30af44dc2f5abc99dc6526d822a429c66242b558499deae0810cee78b2d46acf25d0dddbdcb1885d62eb6426fa9e788055933b5695c69a6a49c5f054ad007
|
7
|
+
data.tar.gz: b1010103a1afcfba25b677894d42a079b57528685d6e878468abfd44ad4a8291ecc463cea593d379fdd59a53f336a617adbb13a26b4e44cc1e79ace5df39d3ae
|
data/lib/snapshotable/model.rb
CHANGED
@@ -29,9 +29,12 @@ module Snapshotable
|
|
29
29
|
end
|
30
30
|
|
31
31
|
module InstanceMethods
|
32
|
-
def take_snapshot!
|
33
|
-
|
34
|
-
|
32
|
+
def take_snapshot!(force = false)
|
33
|
+
record = dup
|
34
|
+
record.id = id
|
35
|
+
|
36
|
+
snapshot = SnapshotCreator.new(record).call
|
37
|
+
snapshot_class.create!(snapshot) if force || should_create_new_snapshot?(snapshot)
|
35
38
|
end
|
36
39
|
|
37
40
|
def snapshots
|
data/lib/snapshotable/version.rb
CHANGED