Hello,
I have three models setup as such…
User
has_many :requests
Request
has_many :changes
Changes
belongs_to :request
belongs_to :who, :class_name => “User”, :foreign_key => “user_id”
A user logs into the system and the id is stored in the session…
Whenever a user creates or edits a request I want an entry created in
the changes table. Basically spelling the who, what, and when…
I have everything working how I want except the “who” part… I am
unsure of an elegant approach. I am using the after_* methods, but the
session is inaccessible to the model (as it should be)… How can I
(the rails way) log the user_id for the change?