mongo_mapper_versioned 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ module MongoMapper
|
|
7
7
|
configuration = { :ignored_keys => %w(_id version_number created_at updated_at creator_id updater_id) }
|
8
8
|
configuration[:ignored_keys].concat(options[:ignored_keys]).uniq if options.key?(:ignored_keys)
|
9
9
|
|
10
|
-
key :version_number, Integer, :index => true
|
10
|
+
key :version_number, Integer, :default => 1, :index => true
|
11
11
|
many :versions, :class => MongoMapper::Plugins::Versioned::Version, :foreign_key => :versioned_id, :dependent => :destroy, :order => :version_number.asc
|
12
12
|
|
13
13
|
after_create :create_version, :if => :should_create_initial_version?
|
@@ -23,8 +23,8 @@ class VersionedTest < ActiveSupport::TestCase
|
|
23
23
|
setup do
|
24
24
|
@doc = VersionedDoc.new
|
25
25
|
end
|
26
|
-
should "be on version
|
27
|
-
|
26
|
+
should "be on version 1" do
|
27
|
+
assert_equal 1, @doc.version_number
|
28
28
|
end
|
29
29
|
should "have 0 versions" do
|
30
30
|
assert_equal 0, @doc.versions.count
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_mapper_versioned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tomas Celizna
|