Project

changes

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Adds logging of changes to your model, so you can see a list of changes - and what the values were changed from
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 0
 Project Readme

Changes

Changes is a gem that logs the changes in your models after you update the values. Let's say you do a

@model = MyModel.create(:amount => 99)

Then after

@model.update_attribute(:amount => 100)

Then you can see the changes

@model.show_changes

Which will return

["Amount changed from 99.0 to 100.0\n"]

Requirements

  • Rails 3.x (Not tested with Rails 3.1)

Installation

In your gemfile:

gem 'changes'

After running a 'bundle install' you need to generate the migrations file

rails generate changes

License

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License

Usage

In the model where you wish to log the changes, when updating. You add

has_changes

Then after an update you can do

@updated_model.show_changes

And the changes will be listed with before and after values