mongo_mapper_acts_as_versioned 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -0
- data/README.md +28 -8
- data/lib/acts_as_versioned/version.rb +1 -1
- metadata +4 -17
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
|
1
|
+
# ActsAsVersioned for [MongoMapper](http://github.com/jnunemaker/mongomapper)
|
2
2
|
|
3
|
-
Basic MongoMapper port of technoweenie's [acts_as_versioned](http://github.com/technoweenie/acts_as_versioned).
|
3
|
+
Basic MongoMapper port of technoweenie's [acts_as_versioned](http://github.com/technoweenie/acts_as_versioned). Stores changed attributes in a Hash key instead of copying all keys from the original model.
|
4
4
|
|
5
|
-
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
### Basic Example
|
6
8
|
|
7
9
|
class Page
|
8
10
|
include MongoMapper::Document
|
9
11
|
|
10
12
|
plugin ActsAsVersioned
|
11
13
|
|
12
|
-
key :title,
|
14
|
+
key :title, String
|
13
15
|
end
|
14
16
|
|
15
17
|
page = Page.create(:title => 'title')
|
@@ -25,21 +27,39 @@ Basic MongoMapper port of technoweenie's [acts_as_versioned](http://github.com/t
|
|
25
27
|
page.title # => 'new title'
|
26
28
|
|
27
29
|
page.revert_to!(1)
|
30
|
+
|
28
31
|
page = page.reload
|
29
32
|
page.version # => 1
|
30
33
|
page.versions.size # => 2
|
31
34
|
page.title # => 'title'
|
32
35
|
|
33
|
-
|
36
|
+
### Keys that do not trigger new versions
|
37
|
+
|
38
|
+
Default ignored keys are:
|
39
|
+
|
40
|
+
* "\_id"
|
41
|
+
* "created\_at"
|
42
|
+
* "updated\_at"
|
43
|
+
* "creator\_id"
|
44
|
+
* "updater\_id"
|
45
|
+
* "version"
|
46
|
+
* the versioned class' foreign key
|
47
|
+
|
48
|
+
### Ignoring additional keys
|
49
|
+
|
50
|
+
Simply add `self.skipped_keys << 'new_skipped_key'` somewhere in your model.
|
51
|
+
|
52
|
+
## Tested with
|
34
53
|
|
35
54
|
* MongoMapper 0.8.3
|
36
55
|
* Ruby 1.9.2
|
37
56
|
|
38
|
-
|
57
|
+
## TODO
|
39
58
|
|
40
59
|
* Add loads more options
|
41
60
|
* Properly document those options
|
61
|
+
* Support SCI
|
42
62
|
|
43
|
-
|
63
|
+
## Copyright
|
44
64
|
|
45
|
-
Copyright (c) 2010 Gigamo
|
65
|
+
Copyright (c) 2010 Gigamo <gigamo@gmail.com>. See LICENSE for details.
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Gigamo
|
@@ -17,23 +17,10 @@ cert_chain: []
|
|
17
17
|
date: 2010-08-27 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
name: mongo_mapper
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
version: "0"
|
31
|
-
type: :runtime
|
32
|
-
version_requirements: *id001
|
33
20
|
- !ruby/object:Gem::Dependency
|
34
21
|
name: rspec
|
35
22
|
prerelease: false
|
36
|
-
requirement: &
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
37
24
|
none: false
|
38
25
|
requirements:
|
39
26
|
- - ">="
|
@@ -42,7 +29,7 @@ dependencies:
|
|
42
29
|
- 0
|
43
30
|
version: "0"
|
44
31
|
type: :development
|
45
|
-
version_requirements: *
|
32
|
+
version_requirements: *id001
|
46
33
|
description: Basic MongoMapper port of technoweenie's acts_as_versioned
|
47
34
|
email:
|
48
35
|
- gigamo@gmail.com
|