workflow_on_mongoid 0.8.0.1 → 0.8.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +17 -9
- data/lib/workflow_on_mongoid/version.rb +1 -1
- data/lib/workflow_on_mongoid/workflow.rb +7 -7
- metadata +6 -6
data/README.rdoc
CHANGED
@@ -8,18 +8,20 @@ workflow_on_mongoid lets you use the {Workflow}[http://github.com/geekq/workflow
|
|
8
8
|
|
9
9
|
In your Gemfile, instead of
|
10
10
|
gem 'workflow'
|
11
|
-
|
11
|
+
|
12
12
|
do
|
13
13
|
gem 'workflow_on_mongoid'
|
14
|
-
|
14
|
+
|
15
15
|
That is all. Now you can use {Workflow}[http://github.com/geekq/workflow] with your {Mongoid}[http://mongoid.org/] documents. Of course, you can still continue to use {Workflow}[http://github.com/geekq/workflow] with ActiveRecord, Remodel and plain objects. All that workflow_on_mongoid does is to add {Mongoid}[http://mongoid.org/] support. You can use all the features of {Workflow}[http://github.com/geekq/workflow] with {Mongoid}[http://mongoid.org/] models, including reflection of events & states, transition hooks, support for inherited models, etc. Just refer to the {Workflow docs}[http://github.com/geekq/workflow].
|
16
|
-
|
16
|
+
|
17
17
|
|
18
18
|
== Versioning
|
19
19
|
|
20
|
-
The version numbers of workflow_on_mongoid track the latest supported version of {Workflow}[http://github.com/geekq/workflow] . The major version number (x.x.x) matches the latest supported version of the Workflow gem, while the minor version number (0.7.0.x) tracks changes to workflow_on_mongoid itself.
|
20
|
+
The version numbers of workflow_on_mongoid track the latest supported version of {Workflow}[http://github.com/geekq/workflow] . The major version number (x.x.x) matches the latest supported version of the Workflow gem, while the minor version number (0.7.0.x) tracks changes to workflow_on_mongoid itself.
|
21
|
+
|
22
|
+
The current version is 0.8.0.2 .
|
21
23
|
|
22
|
-
|
24
|
+
NOTE: workflow_on_mongoid 0.8.0 uses Mongoid 2.0.0.beta.20 . 0.8.0.1+ uses the latest Mongoid 2.0.0.rc . Please choose the appropriate version of workflow_on_mongoid based on the version of Mongoid you are using (the changes from Mongoid 2.0.0.beta to 2.0.0.rc are significant!)
|
23
25
|
|
24
26
|
== Example
|
25
27
|
class MongoidImage
|
@@ -38,10 +40,10 @@ The current version is 0.8.0 .
|
|
38
40
|
end
|
39
41
|
state :converted
|
40
42
|
end
|
41
|
-
end
|
42
|
-
|
43
|
+
end
|
44
|
+
|
43
45
|
See the {tests for Mongoid}[http://github.com/bowsersenior/workflow_on_mongoid/blob/master/test/mongoid_test.rb] for more examples.
|
44
|
-
|
46
|
+
|
45
47
|
== Tests
|
46
48
|
|
47
49
|
I've included all the tests from the original workflow gem and added comprehensive tests for {Mongoid}[http://mongoid.org/] support, which is now as well-tested as ActiveRecord support. Including the existing tests ensures that workflow_on_mongoid implements support for {Mongoid}[http://mongoid.org/] documents without breaking anything.
|
@@ -50,4 +52,10 @@ I've included all the tests from the original workflow gem and added comprehensi
|
|
50
52
|
|
51
53
|
workflow_on_mongoid is hosted on Github: http://github.com/bowsersenior/workflow_on_mongoid . It's a tiny project, but your contributions, forkings, comments and feedback are definitely appreciated.
|
52
54
|
|
53
|
-
|
55
|
+
= Contributors
|
56
|
+
|
57
|
+
Special thanks to:
|
58
|
+
* Guilherme Cirne (https://github.com/gcirne)
|
59
|
+
* Dariusz Gertych (https://github.com/chytreg)
|
60
|
+
|
61
|
+
Copyright (c) 2011 Mani Tadayon, released under the MIT License
|
@@ -7,13 +7,13 @@ module Workflow
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def persist_workflow_state(new_value)
|
10
|
-
self.
|
11
|
-
end
|
12
|
-
|
10
|
+
self.update_attribute(self.class.workflow_column, new_value)
|
11
|
+
end
|
12
|
+
|
13
13
|
private
|
14
14
|
def write_initial_state
|
15
|
-
|
16
|
-
end
|
15
|
+
update_attribute(self.class.workflow_column, current_state.to_s) if load_workflow_state.blank?
|
16
|
+
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.included(klass)
|
@@ -28,8 +28,8 @@ module Workflow
|
|
28
28
|
klass.class_eval do
|
29
29
|
klass.send :field, klass.workflow_column
|
30
30
|
klass.send :include, MongoidInstanceMethods
|
31
|
-
klass.before_validation :write_initial_state
|
31
|
+
klass.before_validation :write_initial_state
|
32
32
|
end
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
35
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workflow_on_mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 11
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.8.0.
|
10
|
+
- 2
|
11
|
+
version: 0.8.0.2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Mani Tadayon
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-06-09 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
202
|
requirements: []
|
203
203
|
|
204
204
|
rubyforge_project:
|
205
|
-
rubygems_version: 1.
|
205
|
+
rubygems_version: 1.6.2
|
206
206
|
signing_key:
|
207
207
|
specification_version: 3
|
208
208
|
summary: Add Mongoid support to the Workflow gem.
|