user_stamp plugin does this so you could check it out. But...
In general, giving your model access to session information (like
current_user) is a big no-no because it breaks MVC and can cause
issues downline. I've never used user_stamp because it's easy enough
to use the scoping provided by AR like:
current_user.widgets.build( params[:widget] )
in place of Widget.new( params[:widget] )
In your case, all you need is:
class Widget < ActiveRecord::Base
belongs_to :user, :foreign_key => 'created_by'
[...]
end
and a similar has_many in the User model and you can use all syntactic
sugar that AR provides on associations.
Rein