Project

memoar

0.0
The project is in a healthy, maintained state
Memoar tracks changes on specified model fields and stores them in a JSON column.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 2.0
~> 5.16
~> 13.0
~> 1.4

Runtime

>= 6.0, < 8.0
 Project Readme

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.