README.md in mongoid-genesis-0.0.1 vs README.md in mongoid-genesis-0.0.2
- old
+ new
@@ -8,20 +8,20 @@
Install
-------
```
-gem install mongoid_genesis
+gem install mongoid-genesis
```
Rails 3
-------
In your Gemfile:
```ruby
-gem 'mongoid_genesis'
+gem 'mongoid-genesis'
```
Usage
-----
@@ -37,49 +37,53 @@
end
```
This will create an embedded object that will store the original data.
-**Basic manipulation**
+**Basic structure**
```ruby
book = Book.new(:title => 'Art of war', :author => 'Sun Tzu')
#=> #<Book _id: 1, title: "Art of war", author: "Sun Tzu">
book.genesis
#=> #<BookGenesis _id: 1>
+```
+**Preserve the original attribute**
-# The origin will be save
-
+```ruby
book.write_and_preserve_attribute(:author, 'Sun Zi')
#=> #<Book _id: 1, title: "Art of war", author: "Sun Zi">
book.genesis
#=> #<BookGenesis _id: 1, author: "Sun Tzu">
+```
+**After preserving the original attribute, it will not be overwritten**
-# The origin will not be overwritten
-
+```ruby
book.write_and_preserve_attribute(:author, 'Sun Wu')
#=> #<Book _id: 1, title: "Art of war", author: "Sun Wu">
book.genesis
#=> #<BookGenesis _id: 1, author: "Sun Tzu">
+```
+**You can restore the original attribute**
-# Restoring the origin
-
+```ruby
book.restore_genesis(:author)
#=> #<Book _id: 1, title: "Art of war", author: "Sun Tzu">
book.genesis
#=> #<BookGenesis _id: 1, author: nil>
+```
+**To update the original document without losing the current state**
-# To make some modifications on the original without losing the current state
-
+```ruby
book.write_and_preserve_attribute(:title, 'The Art of Peace')
book.reverse_genesis
#=> #<Book _id: 1, title: "The Art of War", author: "Sun Tzu">
#=> #<BookGenesis _id: 1, title: "The Art of Peace">
@@ -87,10 +91,9 @@
book.title = "The Art of War : Revisited"
book.reverse_genesis
#=> #<Book _id: 1, title: "The Art of Peace", author: "Sun Tzu">
#=> #<BookGenesis _id: 1, title: "The Art of War : Revisited">
-
```
Copyright
---------