infused / blame
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (2)
- Wiki (1)
- Graphs
-
Tag:
v1.0.0
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Wed Oct 08 15:02:33 -0700 2008 | |
| |
README.md | ||
| |
Rakefile | Wed Oct 08 15:02:33 -0700 2008 | |
| |
about.yml | ||
| |
init.rb | Wed Oct 08 15:02:33 -0700 2008 | |
| |
lib/ | ||
| |
test/ |
Blame
Automatically userstamps create and update operations if the table has fields named created_by and/or updated_by.
Blame adds a userstamps migration helper which will create both created_by and updated_by columns in your table:
create_table :widgets do |t|
t.string :name
t.timestamps
t.userstamps
end
Blame assumes that you are using restful-authentication and defaults to looking for the current user in User.current_user. You
can override this behavior by writing your own userstamp_object method in ActiveRecord::Base or any of your models. For example:
def userstamp_object
User.find(session[:user_id])
end
Automatic userstamping can be turned off globally by setting:
ActiveRecord::Base.record_userstamps = false
Installation
ruby script/plugin install git://github.com/infused/blame.git
Credit
Thanks to DeLynn Berry delynn@gmail.com for writing the original Userstamp plugin (http://github.com/delynn/userstamp/tree/master), which I've used in many project over the last several years. Unfortunately, its grown too complex and hard to keep up to date with Rails releases for my tastes. The Blame plugin attempts to mirror the simplicity of ActiveRecord's timestamp module.
Copyright (c) 2008 Keith Morrison keithm@infused.org, released under the MIT license

