revisions 0.3.2 → 0.3.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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/revisions.rb +8 -6
  3. data/revisions.gemspec +1 -1
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
data/lib/revisions.rb CHANGED
@@ -37,18 +37,20 @@ module Revisions
37
37
  end
38
38
 
39
39
  def save_revision
40
- new_copy = self.dup
41
- attributes_to_nil = {}
42
- self.unrevised_attributes.each {|a| attributes_to_nil[a] = nil }
43
- new_copy.attributes=attributes_to_nil
40
+ new_copy = self.class.new
41
+ cloned_attributes = self.clone_attributes
42
+ self.unrevised_attributes.each {|a| cloned_attributes.delete(a) }
43
+ new_copy.attributes=cloned_attributes
44
44
  new_copy.created_at = new_copy.updated_at = Time.zone.now
45
45
  new_copy.status = 'revision'
46
46
  new_copy.revision_of = self.id
47
- new_copy.id = nil # makes it compatible with rails 3.0, which dupes the id.
48
47
  if new_copy.save
49
48
  true
50
49
  else
51
- new_copy.errors.each {|attribute,message| self.errors[attribute] << message}
50
+ self.errors.clear
51
+ new_copy.errors.each do |attribute,message|
52
+ self.errors[attribute] << message
53
+ end
52
54
  false
53
55
  end
54
56
  end
data/revisions.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{revisions}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Brian Hamman}]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revisions
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Hamman