HasAuditTrail
Disclaimer
This is VERY experimental, please wait until the release 0.1.0 before using it in production!
Installation
Add this line to your application's Gemfile:
gem 'has_audit_trail'
And then execute:
$ bundle
Or install it yourself as:
$ gem install has_audit_trail
Create the migration:
$ rails generate has_audit_trail:install
Usage
class User < ActiveRecord::Base
has_audit_trail
end
class User < ActiveRecord::Base
has_audit_trail :only => [ :name, :email ]
end
class User < ActiveRecord::Base
has_audit_trail :only => [ :name, :email, :projects => { :audit => Proc.new { |p| p.name } } ]
end
class Project < ActiveRecord::Base
has_many :tasks
accepts_nested_attributes_for :tasks
has_audit_trail(
:audit_nested => {
:tasks => {
:label => Proc.new { |task| task.name },
:value_print => Proc.new { |value| value }
}
}
)
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request