Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

do not version #created_at or #created_on

  • Loading branch information...
commit 4b387a1f0abb8f6f9eaf49daf12ef871e841d3c7 1 parent 886d1a0
@technoweenie technoweenie authored
View
2  lib/acts_as_versioned.rb
@@ -185,7 +185,7 @@ def acts_as_versioned(options = {}, &extension)
self.version_sequence_name = options[:sequence_name]
self.max_version_limit = options[:limit].to_i
self.version_condition = options[:if] || true
- self.non_versioned_columns = [self.primary_key, inheritance_column, 'version', 'lock_version', versioned_inheritance_column]
+ self.non_versioned_columns = [self.primary_key, inheritance_column, 'version', 'lock_version', versioned_inheritance_column, 'created_at', 'created_on']
self.version_association_options = {
:class_name => "#{self.to_s}::#{versioned_class_name}",
:foreign_key => versioned_foreign_key,
View
3  test/fixtures/pages.yml
@@ -4,4 +4,5 @@ welcome:
body: Such a lovely day
version: 24
author_id: 1
- revisor_id: 1
+ revisor_id: 1
+ created_on: "2008-01-01 00:00:00"
View
2  test/schema.rb
@@ -3,6 +3,7 @@
t.column :version, :integer
t.column :title, :string, :limit => 255
t.column :body, :text
+ t.column :created_on, :datetime
t.column :updated_on, :datetime
t.column :author_id, :integer
t.column :revisor_id, :integer
@@ -13,6 +14,7 @@
t.column :version, :integer
t.column :title, :string, :limit => 255
t.column :body, :text
+ t.column :created_on, :datetime
t.column :updated_on, :datetime
t.column :author_id, :integer
t.column :revisor_id, :integer
View
7 test/versioned_test.rb
@@ -14,6 +14,13 @@ def test_saves_versioned_copy
assert_instance_of Page.versioned_class, p.versions.first
end
+ def test_version_has_unique_created_at
+ p = pages(:welcome)
+ p.title = 'update me'
+ p.save!
+ assert_not_equal p.created_on, p.versions.latest.created_on
+ end
+
def test_saves_without_revision
p = pages(:welcome)
old_versions = p.versions.count
Please sign in to comment.
Something went wrong with that request. Please try again.