change_logger 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,8 +2,8 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('change_logger', '0.0.1') do |p|
6
- p.description = "A gem for tracking who and what changes"
5
+ Echoe.new('change_logger', '0.0.2') do |p|
6
+ p.description = "A gem for tracking what changes and who did it"
7
7
  p.url = "http://github.com/danengle/awesome_tables"
8
8
  p.author = "Dan Engle"
9
9
  p.email = "engle.68 @nospam@ gmail.com"
@@ -2,13 +2,13 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{change_logger}
5
- s.version = "0.0.1"
5
+ s.version = "0.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Dan Engle"]
9
9
  s.cert_chain = ["/Users/danengle/.ssh/gem-public_cert.pem"]
10
10
  s.date = %q{2010-12-02}
11
- s.description = %q{A gem for tracking who and what changes}
11
+ s.description = %q{A gem for tracking what changes and who did it}
12
12
  s.email = %q{engle.68 @nospam@ gmail.com}
13
13
  s.extra_rdoc_files = ["CHANGELOG", "README", "lib/app/models/change_log.rb", "lib/change_logger.rb", "lib/change_logger/acts_as_change_logger.rb", "lib/change_logger/railtie.rb", "lib/change_logger/whodunnit.rb", "lib/generators/change_logger_generator.rb", "lib/generators/templates/create_change_logs.rb"]
14
14
  s.files = ["CHANGELOG", "MIT-LICENSE", "Manifest", "README", "Rakefile", "lib/app/models/change_log.rb", "lib/change_logger.rb", "lib/change_logger/acts_as_change_logger.rb", "lib/change_logger/railtie.rb", "lib/change_logger/whodunnit.rb", "lib/generators/change_logger_generator.rb", "lib/generators/templates/create_change_logs.rb", "change_logger.gemspec"]
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.rubyforge_project = %q{change_logger}
19
19
  s.rubygems_version = %q{1.3.7}
20
20
  s.signing_key = %q{/Users/danengle/.ssh/gem-private_key.pem}
21
- s.summary = %q{A gem for tracking who and what changes}
21
+ s.summary = %q{A gem for tracking what changes and who did it}
22
22
 
23
23
  if s.respond_to? :specification_version then
24
24
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -13,7 +13,7 @@ module ChangeLogger
13
13
  send :include, InstanceMethods
14
14
  cattr_accessor :ignore
15
15
  self.ignore = (options[:ignore] || []).map &:to_s
16
- self.ignore.push('created_at', 'updated_at')
16
+ self.ignore.push('id', 'created_at', 'updated_at')
17
17
 
18
18
  has_many :change_logs, :as => :item, :order => 'change_logs.created_at desc'
19
19
  after_save :record_attribute_updates
@@ -39,26 +39,22 @@ module ChangeLogger
39
39
  end
40
40
 
41
41
  def record_attribute_updates
42
- self.changes.delete_if { |k,v| self.class.ignore.include?(k) }.each do |key, value|
42
+ self.changes.delete_if { |k,v| self.class.ignore.include?(k) }.each do |key, value|
43
43
  record_change(key, value[0], value[1])
44
44
  end
45
45
  end
46
46
 
47
47
  def record_object_destruction
48
48
  attributes.each do |key, value|
49
- record_change(key, old_value(key), ACTIONS[:delete])
49
+ record_change(key, old_value(value), ACTIONS[:delete])
50
50
  end
51
51
  end
52
52
 
53
53
  private
54
-
55
- def old_value(attribute)
56
- if self.new_record?
57
- ACTIONS[:create]
58
- else
59
- send("#{key}_was")
60
- end
61
- end
54
+
55
+ def old_value(val)
56
+ self.new_record? ? ACTIONS[:create] : val
57
+ end
62
58
 
63
59
  def record_change(attribute_name, old_val, new_val)
64
60
  self.change_logs.create!(
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- iox�%�����:�]�ä05�Ǡ��vcvU.dOūM��ӟ�ӵ�8g���lLΩ�A\GIʦ��|
1
+ $���S�*y2�����d���5���?PWh�����Gf(�7��.�Ul Rm8{�.��?�ߗG3��q��.騾S�Ȟ��<������4d;�/��!D��^ 3�$��T��ݷ�k��M��3r��p�
2
+ �OE����_�Mw}9�����
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dan Engle
@@ -39,7 +39,7 @@ date: 2010-12-02 00:00:00 -06:00
39
39
  default_executable:
40
40
  dependencies: []
41
41
 
42
- description: A gem for tracking who and what changes
42
+ description: A gem for tracking what changes and who did it
43
43
  email: engle.68 @nospam@ gmail.com
44
44
  executables: []
45
45
 
@@ -106,6 +106,6 @@ rubyforge_project: change_logger
106
106
  rubygems_version: 1.3.7
107
107
  signing_key:
108
108
  specification_version: 3
109
- summary: A gem for tracking who and what changes
109
+ summary: A gem for tracking what changes and who did it
110
110
  test_files: []
111
111
 
metadata.gz.sig CHANGED
Binary file