github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

grosser / record_activities

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 27
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Rails: Record user activities without controller helpers, build on top of userstamps plugin — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

rename Rakefile.rb to Rakefile 
grosser (author)
Wed Nov 18 04:03:12 -0800 2009
commit  52e361eb3ff88775e389004f411f15a8a148cb76
tree    2ef2f7384ad3666de68b7b4de8bb1ccb44e14cb6
parent  5aa5ec51e53b9bc8d5dec2cf6602fa99b1fc115a
record_activities /
name age
history
message
file MIGRATION Thu Jan 08 04:02:38 -0800 2009 more docs, less code [grosser]
file README.markdown Wed Nov 18 04:02:48 -0800 2009 update Readme [grosser]
file Rakefile Wed Nov 18 04:03:12 -0800 2009 rename Rakefile.rb to Rakefile [grosser]
file init.rb Thu Jan 08 03:24:33 -0800 2009 shuld work... [grosser]
directory lib/ Fri Mar 13 03:15:43 -0700 2009 added possibility to activity turn recording of... [grosser]
directory spec/ Wed Nov 18 03:39:16 -0800 2009 fix specs, switch to spectask to build on ci se... [grosser]
README.markdown
  • Simple activity logging build on top of userstamp
  • Does not involve the controller
  • Stores an Activity(:action, :actor, :subject) in the database
  • Supports :create, :update, :save and :destroy by default + any user-defined action

Setup

  • Install and setup userstamps
  • script/plugin install git://github.com/grosser/record_activities.git
  • Create an activities table for your database (see: MIGRATION)
  • (Optional) Add has_many :activities, :dependent => :destroy, :foreign_key => :actor_id to your user

Usage

class Comment < ActiveRecord::Base
  stampable
  record_activities :dependent => :destroy
end
Comment.create! --> Activity.create!(:subject => comment, :actor => current_user, :action => 'create')

record_activities is the same as record_activities :create, :update.
You may also use anything other than the supported :create / :update / :save / :destroy, but be sure to call the appropriate
callback model.record_activity_foo when the action foo was performed.

A Comment has_many :activities, if the :association or :dependent option is given:

record_activities :dependent => :destroy
record_activities :association => :something_else    #this will use nullify, so your activities will not be cleaned up

Activity recording can be turned off by setting e.g. Comment.record_userstamp to false.

AUTHORS

Contributors

  • rxcfc

Author

Michael Grosser
grosser.michael@gmail.com
Hereby placed under public domain, do what you want, just do not hold me accountable...

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server