snapshotable 0.1.2 → 0.1.3
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 +1 -4
- data/lib/snapshotable/model_config.rb +0 -7
- 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: 97edd33c2a2d4eb2935bd9549d402d18e8a7e0b5
|
4
|
+
data.tar.gz: 9f2422fd653a7bda5836f1048f7e0816bfd142c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81abb9b0399c32faa5396afc2a7bf7438cac10a731b607d226fe595b3c13ddf2b5d43c56ffd5e3680e2d200567cddb56c2854e6f3142a0ace26b8b11a913b1ec
|
7
|
+
data.tar.gz: 88443b76a5c4916ed257bc65f1397d9a0c8f2161fd5305e024ada7056896baf9a8953f995adcec1ddf9ce6ebb60d49efebea8aae24d6a779f09ffac3d4769974
|
data/lib/snapshotable/model.rb
CHANGED
@@ -30,10 +30,7 @@ module Snapshotable
|
|
30
30
|
|
31
31
|
module InstanceMethods
|
32
32
|
def take_snapshot!(force = false)
|
33
|
-
|
34
|
-
record.id = id
|
35
|
-
|
36
|
-
snapshot = SnapshotCreator.new(record).call
|
33
|
+
snapshot = SnapshotCreator.new(self).call
|
37
34
|
snapshot_class.create!(snapshot) if force || should_create_new_snapshot?(snapshot)
|
38
35
|
end
|
39
36
|
|
@@ -14,7 +14,6 @@ module Snapshotable
|
|
14
14
|
setup_snapshot_names
|
15
15
|
setup_variables
|
16
16
|
setup_association(@model)
|
17
|
-
setup_callback(@model)
|
18
17
|
|
19
18
|
@model.send :include, ::Snapshotable::Model::InstanceMethods
|
20
19
|
end
|
@@ -85,12 +84,6 @@ module Snapshotable
|
|
85
84
|
)
|
86
85
|
end
|
87
86
|
|
88
|
-
def setup_callback(klass)
|
89
|
-
klass.after_create(
|
90
|
-
:take_snapshot!
|
91
|
-
)
|
92
|
-
end
|
93
|
-
|
94
87
|
def snapshot_class_name
|
95
88
|
"#{@model.name}Snapshot"
|
96
89
|
end
|
data/lib/snapshotable/version.rb
CHANGED