vestal_versions 0.8.1 → 0.8.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.
- data/VERSION +1 -1
- data/lib/vestal_versions.rb +3 -5
- data/test/changes_test.rb +0 -7
- data/vestal_versions.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.2
|
data/lib/vestal_versions.rb
CHANGED
@@ -54,11 +54,11 @@ module LaserLemon
|
|
54
54
|
module InstanceMethods
|
55
55
|
private
|
56
56
|
def versioned_columns
|
57
|
-
|
57
|
+
case
|
58
58
|
when version_only_columns then self.class.column_names & version_only_columns
|
59
59
|
when version_except_columns then self.class.column_names - version_except_columns
|
60
60
|
else self.class.column_names
|
61
|
-
end
|
61
|
+
end - %w(created_at created_on updated_at updated_on)
|
62
62
|
end
|
63
63
|
|
64
64
|
def needs_initial_version?
|
@@ -110,10 +110,8 @@ module LaserLemon
|
|
110
110
|
backward = chain.first > chain.last
|
111
111
|
backward ? chain.pop : chain.shift
|
112
112
|
|
113
|
-
timestamps = %w(created_at created_on updated_at updated_on)
|
114
|
-
|
115
113
|
chain.inject({}) do |changes, version|
|
116
|
-
version.changes.
|
114
|
+
version.changes.each do |attribute, change|
|
117
115
|
change.reverse! if backward
|
118
116
|
new_change = [changes.fetch(attribute, change).first, change.last]
|
119
117
|
changes.update(attribute => new_change)
|
data/test/changes_test.rb
CHANGED
@@ -17,13 +17,6 @@ class ChangesTest < Test::Unit::TestCase
|
|
17
17
|
assert_equal changes, @user.versions.last.changes.slice(*changes.keys)
|
18
18
|
end
|
19
19
|
|
20
|
-
should 'contain timestamp changes when applicable' do
|
21
|
-
timestamp = 'updated_at'
|
22
|
-
@user.update_attribute(:name, 'Steve Jobs')
|
23
|
-
assert @user.class.content_columns.map(&:name).include?(timestamp)
|
24
|
-
assert_contains @user.versions.last.changes.keys, timestamp
|
25
|
-
end
|
26
|
-
|
27
20
|
should 'contain no more than the changed attributes and timestamps' do
|
28
21
|
timestamps = %w(created_at created_on updated_at updated_on)
|
29
22
|
@user.name = 'Steve Jobs'
|
data/vestal_versions.gemspec
CHANGED