mongomapper-versioned 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/versioned/meta.rb +1 -1
- data/lib/versioned/version.rb +6 -1
- data/test/models/user.rb +1 -0
- data/test/unit/test_versioning.rb +3 -0
- metadata +33 -22
data/lib/versioned/meta.rb
CHANGED
data/lib/versioned/version.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'active_support/core_ext/array/conversions'
|
2
2
|
require 'mongomapper_id2'
|
3
|
+
require 'yajl'
|
3
4
|
|
4
5
|
class Version
|
5
6
|
include MongoMapper::Document
|
@@ -9,7 +10,7 @@ class Version
|
|
9
10
|
key :doc, Hash
|
10
11
|
key :created_at, Time
|
11
12
|
|
12
|
-
before_create :set_created_at
|
13
|
+
before_create :set_created_at, :encode_doc
|
13
14
|
|
14
15
|
belongs_to :versioned, polymorphic: true
|
15
16
|
belongs_to :updater, polymorphic: true
|
@@ -76,4 +77,8 @@ class Version
|
|
76
77
|
self.created_at = Time.now.utc
|
77
78
|
end
|
78
79
|
end
|
80
|
+
|
81
|
+
def encode_doc
|
82
|
+
self.doc = Yajl::Parser.new.parse(Yajl::Encoder.encode(self.doc))
|
83
|
+
end
|
79
84
|
end
|
data/test/models/user.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongomapper-versioned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: &
|
15
|
+
name: yajl-ruby
|
16
|
+
requirement: &70249446340560 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70249446340560
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bson_ext
|
27
|
-
requirement: &
|
27
|
+
requirement: &70249446336800 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70249446336800
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mongo_mapper
|
38
|
-
requirement: &
|
38
|
+
requirement: &70249446353460 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.10.1
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70249446353460
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mongomapper_id2
|
49
|
-
requirement: &
|
49
|
+
requirement: &70249446351740 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70249446351740
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
|
-
requirement: &
|
60
|
+
requirement: &70249446370360 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70249446370360
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: shoulda
|
71
|
-
requirement: &
|
71
|
+
requirement: &70249446365740 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70249446365740
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: ruby-debug19
|
82
|
-
requirement: &
|
82
|
+
requirement: &70249446385440 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,21 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70249446385440
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: timecop
|
93
|
-
requirement: &
|
93
|
+
requirement: &70249446383680 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70249446383680
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: tzinfo
|
104
|
+
requirement: &70249446381060 !ruby/object:Gem::Requirement
|
94
105
|
none: false
|
95
106
|
requirements:
|
96
107
|
- - ! '>='
|
@@ -98,7 +109,7 @@ dependencies:
|
|
98
109
|
version: '0'
|
99
110
|
type: :development
|
100
111
|
prerelease: false
|
101
|
-
version_requirements: *
|
112
|
+
version_requirements: *70249446381060
|
102
113
|
description:
|
103
114
|
email: alexkwolfe@gmail.com
|
104
115
|
executables: []
|
@@ -135,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
146
|
version: '0'
|
136
147
|
segments:
|
137
148
|
- 0
|
138
|
-
hash:
|
149
|
+
hash: 1755080522254404046
|
139
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
151
|
none: false
|
141
152
|
requirements:
|
@@ -144,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
155
|
version: '0'
|
145
156
|
segments:
|
146
157
|
- 0
|
147
|
-
hash:
|
158
|
+
hash: 1755080522254404046
|
148
159
|
requirements: []
|
149
160
|
rubyforge_project:
|
150
161
|
rubygems_version: 1.8.15
|