suhaspnehete / activity_stream Goto Github PK
View Code? Open in Web Editor NEWThis project forked from evilmarty/activity_stream
Activity stream for rails
License: MIT License
This project forked from evilmarty/activity_stream
Activity stream for rails
License: MIT License
ActivityStream ============== A dead easy way to log activity streams. Installation ============ script/plugin install http://github.com/evilmarty/activity_stream Then run... script/generate activity_stream this will create the Activity model and place it in your app/models path as a migration file. DON'T FORGET to add :activity_observer to your config.active_record.observers in environments.rb like so... config.active_record.observers = :activity_observer Usage ===== For all the models you want to log an activity for do the following... class Comment < ActiveRecord::Base log_activities end this will log an activity for :create, :update and :destroy. To only log an activity for :create simply say so... class Comment < ActiveRecord::Base log_activities :create end You can also pass a Proc which can be used to check whether to log the activity or not, just return false class Comment < ActiveRecord::Base log_activities :create, :destroy log_activities :update do |record| record.status == 1 end end and you can call it multiple times for different actions with different Procs Now once your done with your logging, it's time to define your actors. Like so... class User < ActiveRecord::Base acts_as_actor end and now when you want to log activities simply do the following in your controllers or wherever you please class CommentsController < ApplicationController def create current_user.log_activity('web') do Comment.create params[:comment] end end end that little argument for log_activity is the context of the activity but you can omit it should you feel so. TODO ==== * write better doc * add support for indirect objects maybe? Copyright (c) 2009 Marty Zalega ([email protected]), released under the MIT license
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.