README.md in act_as_releasable-0.0.4 vs README.md in act_as_releasable-0.0.5
- old
+ new
@@ -1,25 +1,69 @@
# ActAsReleasable
-TODO: Write a gem description
+A simple way to manage approval of ActiveRecord models.
+Using ActAsReleasable you can keep track of changed data by creating a candidate without modifying your current model.
+When you need, you can just approve the changes and all data will be updated to your model.
+## TL;DR
+
+```.act_as_releasable :collections => [:name_if_any]``` on your model.
+```#generate_new_candidate``` to apply changes to candidate(without saving).
+```#release_candidate``` to get candidate from model.
+```#release_version!``` to apply candidate changes to model.
+```#has_changes_to_be_approved?``` to check if there is any candidate.
+
## Installation
Add this line to your application's Gemfile:
gem 'act_as_releasable'
-And then execute:
+And then execute (the second step is used to create the gem migrations):
$ bundle
+ $ rails generate act_as_releasable:install
-Or install it yourself as:
+## Usage
- $ gem install act_as_releasable
+In order to make your model releasable, your must call the ```act_as_releasable``` method on your model, like this:
-## Usage
+ class Article
+ act_as_releasable
+ end
-TODO: Write usage instructions here
+After created, any model who act as releasable is able to generate a candidate.
+
+ article = Article.find(5) # <Article id: 5, title: "Whoa! ActAsReleasable is live!", ...>
+ article.title = "ActAsRelesable just received some care :)"
+ article.generate_new_candidate
+
+Every ActiveRecord::Base model will work as usual, unless you specify it to behave like releasable(I mean, no AR method is overrided).
+
+After creating a new candidate, you can load it by doing the following.
+
+ article = Article.find(5) # <Article id: 5, title: "Whoa! ActAsReleasable is live!", ...>
+ # ...
+ article.release_candidate.title # "ActAsRelesable just received some care :)"
+
+To approve a candidate, you should use the ```release_version!``` method.
+
+ article = Article.find(5) # <Article id: 5, title: "Whoa! ActAsReleasable is live!", ...>
+ # ...
+ article.release_version!
+ article = Article.find(5) # <Article id: 5, title: "ActAsRelesable just received some care :)", ...>
+
+###The last but not the least:
+
+You can have candidates for collections, by specifying them like this:
+
+ class Article
+ act_as_releasable :collections => [:comments]
+ end
+
+And check if the model has any change to be approved.
+
+ article.has_changes_to_be_approved?
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)