active_snapshot 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/active_snapshot/models/concerns/snapshots_concern.rb +2 -2
- data/lib/active_snapshot/version.rb +1 -1
- data/test/dummy_app/app/models/note.rb +5 -0
- data/test/dummy_app/app/models/post.rb +3 -1
- data/test/dummy_app/db/migrate/20210128155312_set_up_test_tables.rb +8 -0
- data/test/models/snapshots_concern_test.rb +6 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa10e744bf82bbd9037fc6965450546800d9688f9c34aa89cafb952b0d28abf9
|
4
|
+
data.tar.gz: 6b142e6e221584c579291a6c25744d2b1fef0264d66f8b3cc209ff903a67ecd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51fa1393301eebb25e05a829f944a08ef90c714ecd4da759a709cf6e9648175cbf758e8e699c4e43fe973ad3c4227379c3e3a123d49f6b57352b0ce6ee5e1b28
|
7
|
+
data.tar.gz: f9ee1f4a4a7f2386a4854f337fad374b22226c2f9bbdb57cb47989859b9729d0251d403ed900c41dbe392525a02fc02d1c1392d87308c328809e8b7d299f91de
|
data/CHANGELOG.md
CHANGED
@@ -2,9 +2,13 @@ CHANGELOG
|
|
2
2
|
---------
|
3
3
|
|
4
4
|
- **Unreleased**
|
5
|
-
* [View Diff](https://github.com/westonganger/active_snapshot/compare/v0.
|
5
|
+
* [View Diff](https://github.com/westonganger/active_snapshot/compare/v0.2.0...master)
|
6
6
|
* Nothing yet
|
7
7
|
|
8
|
+
- **v0.2.0** - May 7, 2021
|
9
|
+
* [PR #1](https://github.com/westonganger/active_snapshot/pull/1) - Fix bug where only the first child association would be captured
|
10
|
+
* [View Diff](https://github.com/westonganger/active_snapshot/compare/v0.1.1...v0.2.0)
|
11
|
+
|
8
12
|
- **v0.1.1** - Mar 5, 2021
|
9
13
|
* Switch from JSON to Text because Mysql2 has errors with active_record-import and JSON objects
|
10
14
|
* Fix test suite
|
@@ -101,9 +101,9 @@ module ActiveSnapshot
|
|
101
101
|
else
|
102
102
|
raise ArgumentError.new("Invalid `has_snapshot_children` definition. Invalid :records argument. Must be a Hash or Array")
|
103
103
|
end
|
104
|
-
|
105
|
-
return snapshot_children
|
106
104
|
end
|
105
|
+
|
106
|
+
return snapshot_children
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -2,12 +2,14 @@ class Post < ActiveRecord::Base
|
|
2
2
|
include ActiveSnapshot
|
3
3
|
|
4
4
|
has_many :comments
|
5
|
+
has_many :notes
|
5
6
|
|
6
7
|
has_snapshot_children do
|
7
|
-
instance = self.class.includes(:comments).find(id)
|
8
|
+
instance = self.class.includes(:comments, :notes).find(id)
|
8
9
|
|
9
10
|
{
|
10
11
|
comments: instance.comments,
|
12
|
+
notes: instance.notes,
|
11
13
|
}
|
12
14
|
end
|
13
15
|
end
|
@@ -106,6 +106,12 @@ class SnapshotsConcernTest < ActiveSupport::TestCase
|
|
106
106
|
|
107
107
|
klass.new.children_to_snapshot
|
108
108
|
end
|
109
|
+
|
110
|
+
klass.has_snapshot_children do
|
111
|
+
{foo: {records: 'bar'}, baz: {records: 'barbaz'}}
|
112
|
+
end
|
113
|
+
|
114
|
+
assert klass.new.children_to_snapshot.count == 2
|
109
115
|
end
|
110
116
|
|
111
117
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_snapshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Ganger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- test/dummy_app/app/controllers/application_controller.rb
|
149
149
|
- test/dummy_app/app/models/application_record.rb
|
150
150
|
- test/dummy_app/app/models/comment.rb
|
151
|
+
- test/dummy_app/app/models/note.rb
|
151
152
|
- test/dummy_app/app/models/post.rb
|
152
153
|
- test/dummy_app/app/models/volatile_post.rb
|
153
154
|
- test/dummy_app/app/views/layouts/application.html.erb
|
@@ -211,6 +212,7 @@ test_files:
|
|
211
212
|
- test/test_helper.rb
|
212
213
|
- test/unit/active_snapshot_test.rb
|
213
214
|
- test/unit/errors_test.rb
|
215
|
+
- test/dummy_app/app/models/note.rb
|
214
216
|
- test/dummy_app/app/models/comment.rb
|
215
217
|
- test/dummy_app/app/models/volatile_post.rb
|
216
218
|
- test/dummy_app/app/models/application_record.rb
|