<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>opensoul.org - User auditing with acts_as_audited Comments</title>
  <id>tag:opensoul.org,2008:/2006/11/19/user-auditing-with-acts_as_audited/comments</id>
  <generator version="0.8.0" uri="http://mephistoblog.com">Mephisto Drax</generator>
  <link href="http://opensoul.org/2006/11/19/user-auditing-with-acts_as_audited/comments.xml" rel="self" type="application/atom+xml"/>
  <link href="/2006/11/19/user-auditing-with-acts_as_audited" rel="alternate" type="text/html"/>
  <updated>2007-05-01T20:28:56Z</updated>
  <entry xml:base="http://opensoul.org/">
    <author>
      <name>Brandon</name>
    </author>
    <id>tag:opensoul.org,2006-11-19:673:2865</id>
    <published>2007-05-01T20:28:56Z</published>
    <updated>2007-05-01T20:28:56Z</updated>
    <category term="Code"/>
    <link href="http://opensoul.org/2006/11/19/user-auditing-with-acts_as_audited" rel="alternate" type="text/html"/>
    <title>Comment on 'User auditing with acts_as_audited' by Brandon</title>
<content type="html">&lt;p&gt;Ah, yes. The &lt;a href=&quot;http://railstips.org/2006/11/18/class-and-instance-variables-in-ruby&quot;&gt;class variable vs. class instance variable&lt;/a&gt; problem.&lt;/p&gt;


	&lt;p&gt;I have tried it with &lt;span class=&quot;caps&quot;&gt;STI&lt;/span&gt;, but I wanted all the instances to be audited, so it worked fine for me.&lt;/p&gt;


	&lt;p&gt;I&#8217;ll look into this tonight.  Most likely what is happening is that acts_as_audited is using class variables, which are shared throughout the inheritance hierarchy, instead of class instance variables (I wrote the plugin before I had any idea that there was a difference).&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;Worse, when it creates these audits, the auditable_type is always Membership.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;This is actually intended behavior.  I&#8217;ll need to verify this, but I believe polymorphic associations use the name of the base AR class in &lt;span class=&quot;caps&quot;&gt;STI&lt;/span&gt;.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://opensoul.org/">
    <author>
      <name>Sheldon Hearn</name>
    </author>
    <id>tag:opensoul.org,2006-11-19:673:2864</id>
    <published>2007-05-01T20:11:04Z</published>
    <updated>2007-05-01T20:11:04Z</updated>
    <category term="Code"/>
    <link href="http://opensoul.org/2006/11/19/user-auditing-with-acts_as_audited" rel="alternate" type="text/html"/>
    <title>Comment on 'User auditing with acts_as_audited' by Sheldon Hearn</title>
<content type="html">&lt;p&gt;Have you tried acts_as_audited with single table inheritance?&lt;/p&gt;


	&lt;p&gt;I have an AbstractMembership class, which extends ActiveRecord, is instructed to use the memberships table and is marked abstract.  The table has a type column to support &lt;span class=&quot;caps&quot;&gt;STI&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;Then I have Membership, NewMembershipRequest, ChangeMembershipRequest and RemoveMembershipRequest, each of which extends AbstractMembership.  Only Membership acts_as_audited, but the plugin records audits for the other subclasses of AbstractMembership  as well.&lt;/p&gt;


	&lt;p&gt;Which is weird, I think.  Worse, when it creates these audits, the auditable_type is always Membership.&lt;/p&gt;


	&lt;p&gt;It&#8217;s almost like acts_as_audited is digging its claws in too high up the class hierarchy.  Any advice?&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://opensoul.org/">
    <author>
      <name>Jodi</name>
    </author>
    <id>tag:opensoul.org,2006-11-19:673:912</id>
    <published>2007-01-28T18:26:25Z</published>
    <updated>2007-01-28T18:26:25Z</updated>
    <category term="Code"/>
    <link href="http://opensoul.org/2006/11/19/user-auditing-with-acts_as_audited" rel="alternate" type="text/html"/>
    <title>Comment on 'User auditing with acts_as_audited' by Jodi</title>
<content type="html">&lt;p&gt;Venkat &#8211; you may consider using act_as_audited in combination with acts_as_paranoid (which marks but doesn&#8217;t actually delete records).&lt;/p&gt;


	&lt;p&gt;Jodi&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://opensoul.org/">
    <author>
      <name>Venkat</name>
    </author>
    <id>tag:opensoul.org,2006-11-19:673:712</id>
    <published>2006-12-24T15:35:22Z</published>
    <updated>2006-12-24T15:35:22Z</updated>
    <category term="Code"/>
    <link href="http://opensoul.org/2006/11/19/user-auditing-with-acts_as_audited" rel="alternate" type="text/html"/>
    <title>Comment on 'User auditing with acts_as_audited' by Venkat</title>
<content type="html">&lt;p&gt;Dear Brandon:&lt;/p&gt;


	&lt;p&gt;Thanks for the nice plugin. I just played with it a bit.&lt;/p&gt;


	&lt;p&gt;Here is a suggestion for your consideration. For destroy operation, the plugin doesn&#8217;t store anything on the changes column. However for new operation it does store the entire new record. Wouldn&#8217;t it be a good idea to keep the destroy and create at the same level so that when I know something got deleted, I know the contents of the deleted record also?&lt;/p&gt;


	&lt;p&gt;Thanks,
Venkat.&lt;/p&gt;</content>  </entry>
</feed>
