ActivityLog
A very simple activity logging facility, used to record a log of events attached to a unique ID.
Installation
Add this line to your application's Gemfile:
gem 'activity_log'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install activity_log
Once you have the gem installed execute:
$ rails g activity_log:install
followed by
$ rake db:migrate
This will create the activity_log_entry model and migration as well as creating the new table in the database.
Usage
Once installed you can then add new activity log entries with by first including the actvity_log library via:
class MyController < ApplicationController
include ActivityLog
and use the following methods to add and retrieve activity log entries: Create a new entry:
ActivityLog.log(owner_id, "user logged in")
Retrieve a single entry
@entry = ActivityLog.get_by_id(activity_log_entry_id)
Retrieve all entries for a unique id
@entries = ActivityLog.get_by_owner(owner_id)
Retrieve all entries for a unique id within a specific timeframe
@entries = ActivityLog.get_by_owner_and_range(owner_id, start_date, end_date)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request