From 436e16de508c1c8885481b349b41bf0d60d84c44 Mon Sep 17 00:00:00 2001 From: Reid Morrison Date: Sat, 14 Feb 2015 13:16:27 -0500 Subject: [PATCH] Update readme --- .gitignore | 1 - README.md | 23 ++++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index fc0948c..078ecca 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,3 @@ alto .rspec .bundle tags -/nbproject/ diff --git a/README.md b/README.md index 395c6d2..322349a 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ This package contains AASM, a library for adding finite state machines to Ruby c AASM started as the *acts_as_state_machine* plugin but has evolved into a more generic library that no longer targets only ActiveRecord models. It currently provides adapters for -[ActiveRecord](http://api.rubyonrails.org/classes/ActiveRecord/Base.html) and -[Mongoid](http://mongoid.org/), but it can be used for any Ruby class, no matter what +[ActiveRecord](http://api.rubyonrails.org/classes/ActiveRecord/Base.html), +[Mongoid](http://mongoid.org/), and [Mongomapper](http://mongomapper.com/) but it can be used for any Ruby class, no matter what parent class it has (if any). ## Upgrade from version 3 to 4 @@ -435,7 +435,7 @@ to ```false```. ### Sequel -AASM also supports [Sequel](http://sequel.jeremyevans.net/) besides _ActiveRecord_ and _Mongoid_. +AASM also supports [Sequel](http://sequel.jeremyevans.net/) besides _ActiveRecord_, _Mongoid_, and _MongoMapper_. ```ruby class Job < Sequel::Model @@ -466,6 +466,23 @@ class Job end ``` +### MongoMapper + +AASM also supports persistence to Mongodb if you're using MongoMapper. Make sure +to include MongoMapper::Document before you include AASM. + +```ruby +class Job + include MongoMapper::Document + include AASM + + key :aasm_state, Symbol + aasm do + ... + end +end +``` + ### Automatic Scopes AASM will automatically create scope methods for each state in the model.