Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Smooth acitivity tracking for models - similiar to github's Public Activity

branch: destroy

This branch is 0 commits ahead and 62 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

PublicActivity

public_activity provides smooth acitivity tracking for your ActiveRecord models in Rails 3. Simply put: it records what has been changed or edited and gives you the ability to present those recorded activities to users - in a similar way Github does it.

Installation

You can install this gem as you would any other gem: gem install public_activity or in your Gemfile: gem 'public_activity'

Usage

Create migration for activities (in your Rails project): rails g public_activity:migration rake db:migrate

Add 'tracked' to the model you want to keep track of: class Article < ActiveRecord::Base tracked end And now, by default create/update/destroy activities are recorded in activities table. To display them you can do a simple query: # some_controller.rb def index @activities = PublicActivity::Activity.all end And in your views: <% for activity in @activities %> <%= activity.text %>
<% end %> The only thing left is to add translations to your locale files, for example: en: activity: article: create: 'Article has been created' update: 'Someone has edited the article' destroy: 'Some user removed an article!'

This is only a basic example, refer to documentation for more options and customization!

Documentation

You can find documentation here

License

Copyright (c) 2011 Piotrek Okoński, released under the MIT license

Something went wrong with that request. Please try again.