created-and-updated-by 0.1.2 → 0.1.3

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{created-and-updated-by}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Daniels"]
12
- s.date = %q{2010-01-21}
12
+ s.date = %q{2010-02-01}
13
13
  s.description = %q{This gem extends ActiveRecord::Base causing created_by_id and updated_by_id attributes to be set magically with about 30 LOC}
14
14
  s.email = %q{james@jamesdaniels.net}
15
15
  s.extra_rdoc_files = [
@@ -25,7 +25,7 @@ module CreatedAndUpdatedBy
25
25
  def set_stamps
26
26
  if stamper && stamper.respond_to?(:id) && respond_to?(:created_by_id) && respond_to?(:updated_by_id)
27
27
  self.created_by_id = stamper.id if new_record?
28
- self.updated_by_id = stamper.id
28
+ self.updated_by_id = stamper.id if changed?
29
29
  end
30
30
  end
31
31
  end
@@ -24,6 +24,8 @@ describe WithCreated do
24
24
  User.current = User.first
25
25
  created = WithCreated.create!
26
26
  User.current = User.last
27
+ created.save!
28
+ created.updated_by_id.should == User.first.id
27
29
  created.something = 'blah blah something else'
28
30
  created.save!
29
31
  created.created_by_id.should == User.first.id
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: created-and-updated-by
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Daniels
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-21 00:00:00 -05:00
12
+ date: 2010-02-01 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency