culturecode-track_changes 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +2 -1
- data/app/models/track_changes/diff.rb +5 -0
- data/lib/track_changes/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bfa353667777cba682df7ab603e3b4b21054439c6f6d91e4c0a0a719a244de33
|
4
|
+
data.tar.gz: 1155b70851fddaa85d6c10e7c0e9541649117ed8a9cf6dd38550788559269093
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e9f8c86da3f47175fd32bdefc8b070f2526dea41fcc279f5a4e4392dd464eec3d4ca68b2f2b9fd9d785c87c47e110d50463f382875cfd360e9ee3a222c603e7
|
7
|
+
data.tar.gz: 2cb9c5348ac4a7d6f24c1c3bbd0f1eed42098d5d361009d8ec2d5a820863dba06ea2f2333db2cb61a015f7c90d593cf821dae14cd477ac03eaf6ffcbc926153f
|
data/README.md
CHANGED
@@ -48,7 +48,8 @@ the record's id will be used.
|
|
48
48
|
|
49
49
|
```ruby
|
50
50
|
# Model-level attribution
|
51
|
-
person.
|
51
|
+
person.track_changes_by = 'Joe Changems'
|
52
|
+
person.save
|
52
53
|
|
53
54
|
# Block-level attribution
|
54
55
|
TrackChanges.with_changes_attributed_to 'Joe Changems' do
|
@@ -7,6 +7,11 @@ module TrackChanges
|
|
7
7
|
serialize :from, Hash
|
8
8
|
serialize :to, Hash
|
9
9
|
|
10
|
+
# Returns changes but only those where the string representation of the value has changed
|
11
|
+
def visible_changes
|
12
|
+
changes.select {|key, (from, to)| (from.present? || to.present?) && (from.to_s != to.to_s) }
|
13
|
+
end
|
14
|
+
|
10
15
|
# Returns a hash of changes where the key is the field name
|
11
16
|
# and the value is an array of the from value and the to value
|
12
17
|
def changes
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: culturecode-track_changes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Jakobsen, Ryan Wallace
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.2.
|
19
|
+
version: 4.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.2.
|
26
|
+
version: 4.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.7.9
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Easily track changes to various ActiveRecord models
|