Greg Hauptmann
2006-Sep-04 11:22 UTC
acts_as_audited - with ActiveRBAC? - how to setup User
Hi,
I have ActiveRBAC working, but I''m trying to use acts_as_audited (
http://opensoul.org/2006/07/21/acts_as_audited/ ). I''m not exactly
sure
how to setup the required class/object with the appropriate method that
it needs to get the username. You can configure a user_class_name and
a method_name within this which will pull back the userid/name. Refer
to extract from one method within the plugin below. What I''m not sure
about (still new to ruby) is how to:
a) setup the appropriate class
b) probably more to the point, how to make sure it''s in the required
context for acts_as_audited to get
Any ideas?
======================================= def write_audit(action =
:update)
user = self.audited_user_class_name ?
Object.const_get(audited_user_class_name).send(self.audited_user_method)
: nil
audits.create(:changes => @changed_attributes, :action =>
action.to_s, :user_id => user ? user.id : nil)
end
=======================================
Tks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---