Accessing controllers from models

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: params[:widget] )

in place of params[:widget] )

In your case, all you need is:

class Widget < ActiveRecord::Base

belongs_to :user, :foreign_key => 'created_by'



and a similar has_many in the User model and you can use all syntactic
sugar that AR provides on associations.