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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cfddea8f7f37242ef70cad9d17b2bbbea5d610a6
4
- data.tar.gz: 250ab77746cd7991f5eabe04b71dffec39be896a
2
+ SHA256:
3
+ metadata.gz: bfa353667777cba682df7ab603e3b4b21054439c6f6d91e4c0a0a719a244de33
4
+ data.tar.gz: 1155b70851fddaa85d6c10e7c0e9541649117ed8a9cf6dd38550788559269093
5
5
  SHA512:
6
- metadata.gz: 8f29bda1a82ad609e32868a3611be8ab996c52f496ff4b3150e64a46e6fbd0d6fc03d129b1bd4faae386b01a2e028154ac1e9922f1aa505c1c7ba83f1215d75c
7
- data.tar.gz: 9da20ea1201d384476e2ab94d07cc577f1f419ec9dcd9a0190cf1074a861f168121f60c8e7a057a27f167f601e7fa01f5dc115848a19b6b1350911ba4d139cc3
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.save(:changes_by => 'Joe Changems')
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
@@ -1,3 +1,3 @@
1
1
  module TrackChanges
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.2
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: 2015-09-29 00:00:00.000000000 Z
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.1
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.1
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.4.6
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