-
WulinAudit is depends on mongoDB database, before use it you need install mongodb.
On Mac OS X using Homebrew:
brew install mongodb
On Ubuntu & Debian: please read the installation from mongoDB Official Website : Ubuntu and Debian packages.
-
Put
gem wulin_auditto your Gemfile:gem wulin_audit
-
Run bundler command to install the gem:
bundle install
-
Now, you have WulinAudit::AuditLogsController and WulinAudit::AuditLog model, and it will audit all the models automatically.
Attributes in
WulinAudit::AuditLog:user_id # current user's id, equal to +User.current_user.try(:id)+ user_email # current user's email, equal to +User.current_user.try(:email)+ record_id # id for record which was audited. action # current action name class_name # class name for record which was audited detail # changes detail.
WulinAudit will audit all the models automatically; if you do not want audit some, use
reject_auditmethod:class Post < ActiveRecord::Base reject_audit end
the
Postmodel will skip audit.If a module was audited, WulinAudit will audit all the columns automatically, You also can control which columns need audit, you need use
audit_columnsmethod:class Post < ActiveRecord::Base audit_columns(%w(title content category) & column_names) audit_columns :title, :content, :category audit_columns 'title', 'content', 'category' end
Note that,
audit_columnswill be ignored when audit be rejected byreject_auditmethod
{WulinMaster}[https://github.com/wulin/wulin_master] is a grid gem base on SlickGrid. It provide powerfull generator and other tools to make grids easy to build. WulinAudit support WulinMaster well. if you use WulinMaster gem,it will support it automatically.
Jimmy, Xuhao and Maxime Guilbot from Ekohe, inc.
WulinOAuth is released under the MIT license.