track_history 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  module TrackHistory
2
2
 
3
3
  autoload :VERSION, File.join(File.dirname(__FILE__), 'track_history', 'version')
4
+ require 'rubygems'
4
5
  require 'active_record'
5
6
 
6
7
  def self.install
@@ -64,8 +65,8 @@ module TrackHistory
64
65
 
65
66
  # tell the other class about us
66
67
  # purposely don't define these until after getting historical_fields
67
- has_many :histories, :class_name => class_name, :order => 'created_at desc'
68
- before_save :record_historical_changes
68
+ has_many :histories, :class_name => class_name, :order => 'created_at desc', :dependent => :destroy
69
+ before_update :record_historical_changes
69
70
 
70
71
  end
71
72
 
@@ -80,6 +81,12 @@ module TrackHistory
80
81
  end
81
82
  end
82
83
 
84
+ def to_s
85
+ modifications.map do |field|
86
+ "#{field}: " + send(:"#{field}_before") + '=>' + send(:"#{field}_after")
87
+ end.join(', ')
88
+ end
89
+
83
90
  end
84
91
 
85
92
  module InstanceMethods
@@ -1,5 +1,5 @@
1
1
  module TrackHistory
2
2
 
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: track_history
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
4
+ hash: 27
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Crepezzi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-05 00:00:00 -05:00
18
+ date: 2011-01-06 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  requirements: []
74
74
 
75
75
  rubyforge_project: historical
76
- rubygems_version: 1.3.7
76
+ rubygems_version: 1.4.1
77
77
  signing_key:
78
78
  specification_version: 3
79
79
  summary: Smart model auditing