linkingpaths / acts_as_scribe

A simple plugin that allows to keep track of the users activity. Common uses could be user's wall, public timeline portlets, etc...

This URL has Read+Write access

acts_as_scribe / README.markdown
d1841f9c » aitor 2008-09-09 Readme touched 1 ActsAsScribe
6bd9ae7c » aitor 2008-09-09 to markdown 2 ============
d1841f9c » aitor 2008-09-09 Readme touched 3 A simple plugin that allows to keep history records of the users activities. Common uses could be user's wall, public timeline portlets, etc...
4
6bd9ae7c » aitor 2008-09-09 to markdown 5 > Scribe (From Wikipedia, the free encyclopedia):
d1841f9c » aitor 2008-09-09 Readme touched 6 "A scribe was traditionally a person who could read and write. This usually indicated secretarial and administrative duties such as dictation and keeping business, judicial, and history records for kings, nobles, temples, and cities."
7
a2833f0b » aitor 2008-09-09 Readme on markdown 8 Resources
6bd9ae7c » aitor 2008-09-09 to markdown 9 =========
d1841f9c » aitor 2008-09-09 Readme touched 10
11 Install
6bd9ae7c » aitor 2008-09-09 to markdown 12 -------
d1841f9c » aitor 2008-09-09 Readme touched 13
14 * Run the following command:
15
a2833f0b » aitor 2008-09-09 Readme on markdown 16 `script/plugin install git://github.com/linkingpaths/acts_as_scribe.git`
d1841f9c » aitor 2008-09-09 Readme touched 17
18 * Generate the tables via the given generator:
19
a2833f0b » aitor 2008-09-09 Readme on markdown 20 `script/generate acts_as_scribe_migration`
d1841f9c » aitor 2008-09-09 Readme touched 21
22 * And finally...
23
a2833f0b » aitor 2008-09-09 Readme on markdown 24 `rake db:migrate`
d1841f9c » aitor 2008-09-09 Readme touched 25
519713f5 » aitor 2009-02-24 New version 0.1 26 Record activities in your models
27 ---------------------------------------------
d1841f9c » aitor 2008-09-09 Readme touched 28
a2833f0b » aitor 2008-09-09 Readme on markdown 29 <pre>
d1841f9c » aitor 2008-09-09 Readme touched 30 class Comment < ActiveRecord::Base
ffc49443 » aitor 2008-09-16 New tests and fixed libraries 31 record_activity_of :user
d1841f9c » aitor 2008-09-09 Readme touched 32 end
a2833f0b » aitor 2008-09-09 Readme on markdown 33 </pre>
519713f5 » aitor 2009-02-24 New version 0.1 34 You can use any association that is related to an user:
35 <pre>
36 class Post < ActiveRecord::Base
37 belongs_to :author, :class_name => "User"
38 record_activity_of :author
39 end
40 </pre>
41
42 This will register automatically a new activity when you create or destroy a new record. If you want control over the activities registration based on your model's state just use the :if option
5d1c49aa » aitor 2008-09-16 Added record_activities exa... 43
44 <pre>
519713f5 » aitor 2009-02-24 New version 0.1 45 class Post < ActiveRecord::Base
46 belongs_to :author, :class_name => "User"
47 record_activity_of :author, :if => Proc.new { |post| post.private == false }
48 end
49 </pre>
50
51
52 Record activities without related item
53 --------------------------------------
54
55 If you want to record activities not related to any specific model just use `Activity.report` in your code:
56 <pre>
57 def grant_admin(user)
58 user.admin = true
59 Activity.report(current_user, :grant_admin, user)
60 end
61 </pre>
62 If the action is not related to any item, just don't use it.
63 <pre>
64 def login
65 current_user = User.find(…)
66 Activity.report(current_user, :login)
5d1c49aa » aitor 2008-09-16 Added record_activities exa... 67 end
68 </pre>
d1841f9c » aitor 2008-09-09 Readme touched 69
70
71
6bd9ae7c » aitor 2008-09-09 to markdown 72 More
73 -------
a2833f0b » aitor 2008-09-09 Readme on markdown 74
75 [http://github.com/linkingpaths/acts\_as\_scribe](http://github.com/linkingpaths/acts_as_scribe)
76
77 [http://github.com/linkingpaths/acts\_as\_scribe/wikis](http://github.com/linkingpaths/acts_as_scribe/wikis)
d1841f9c » aitor 2008-09-09 Readme touched 78
79
80 Copyright (c) 2008 Linking Paths, released under the MIT license