create_update_by Plugin

Posted by Brian in Products, Rails (February 10th, 2006)

Provides optional functionality on “save” and “update_attributes” methods
that allows developers to pass the user id as a parameter.


Assume you have a books table

  create_table :books do |t|
    t.column :created_at, :datetime
    t.column :updated_at, :datetime
    t.column :title, :string
    t.column :created_by, :integer
    t.column :updated_by, :integer

In your controller, you can now do

  b =
  b.title = "My Book'[:user_id]

If you don’t have created_by or updated_by in your table, the stamping will not occur.
No additonal configuration is needed.


Installation is easy… just use the built-in Plugin installer for Rails.

ruby script/plugin install


Thanks to DeLynn Berry, the creator of the original Userstamp plugin for the idea.
The Userstamp plugin can be found at

This plugin was created because I wanted to provide more control
over the assignment of created_by and updated_by.

Leave a reply

:mrgreen: :neutral: :twisted: :shock: :smile: :???: :cool: :evil: :grin: :oops: :razz: :roll: :wink: :cry: :eek: :lol: :mad: :sad: