Skip to content

amigobg/memoar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Memoar

Welcome to memoar! A simple versioning gem for ActiveRecord models using a JSON column.

Installation

Add this line to your application's Gemfile:

gem 'memoar'

And then execute:

bundle install

Or install it yourself as:

gem install memoar

Usage

  1. Generate a migration to add the version_log column to your model:
rails generate memoar:install ModelName
  1. Run the migration:
rails db:migrate
  1. In your ActiveRecord model, specify fields to track:
class Article < ApplicationRecord
  track_changes_to :title, :content
end

or with limit of recorded changes (default 50):

class Article < ApplicationRecord
  track_changes_to :title, :content, limit: 10
end
article.previous_versions

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/amigobg/memoar.

License

The gem is available as open source under the terms of the MIT License.

About

A simple versioning Ruby gem for ActiveRecord models using a JSON column.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published