Not Yet Active Record
"We take the 'Active' out of Active Record"
Not Yet Active Record is an extension to Active Record that allows any Active Record object to be persisted in a serialized state in one separate table in the database. The objects can be pulled from the database and deserialized at any later time to save into the database.
Installation
gem install not_yet_active_record
Next to create the UnsavedObject model and table.
rails generate not_yet_active_record
rake db:migrate
Rails will ask if you want to overwrite unsaved_object.rb
. Confirm that you
do.
Usage
Send any Active Record object to the UnsavedObject table with the
not_yet_save
method:
@post.not_yet_save
Get an array of any unsaved objects of a particular class with:
Post.not_yet_saved
A copy of the original object can be deserialized from an UnsavedObject model with the item method:
@unsaved_obj.item
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request