<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: The Blame Game</title>
	<atom:link href="http://www.infused.org/2009/01/05/the-blame-game/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.infused.org/2009/01/05/the-blame-game/</link>
	<description></description>
	<lastBuildDate>Wed, 19 Aug 2009 08:02:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Keith</title>
		<link>http://www.infused.org/2009/01/05/the-blame-game/comment-page-1/#comment-45219</link>
		<dc:creator>Keith</dc:creator>
		<pubDate>Mon, 02 Feb 2009 23:32:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.infused.org/?p=440#comment-45219</guid>
		<description>I usually combine blame with the acts_as_versioned or acts_as_audited plugins when I need to track record updates.</description>
		<content:encoded><![CDATA[<p>I usually combine blame with the acts_as_versioned or acts_as_audited plugins when I need to track record updates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Morrison</title>
		<link>http://www.infused.org/2009/01/05/the-blame-game/comment-page-1/#comment-45209</link>
		<dc:creator>Scott Morrison</dc:creator>
		<pubDate>Mon, 02 Feb 2009 21:10:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.infused.org/?p=440#comment-45209</guid>
		<description>Can you have it output messages to syslog or another logging facility as well?</description>
		<content:encoded><![CDATA[<p>Can you have it output messages to syslog or another logging facility as well?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Coyle</title>
		<link>http://www.infused.org/2009/01/05/the-blame-game/comment-page-1/#comment-43230</link>
		<dc:creator>Stuart Coyle</dc:creator>
		<pubDate>Fri, 16 Jan 2009 22:51:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.infused.org/?p=440#comment-43230</guid>
		<description>Ah, yes. That makes sense! It&#039;s pretty close to what I ended up doing.
Thanks,
And thanks for Blame, it&#039;s made my life easier.</description>
		<content:encoded><![CDATA[<p>Ah, yes. That makes sense! It&#8217;s pretty close to what I ended up doing.<br />
Thanks,<br />
And thanks for Blame, it&#8217;s made my life easier.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith</title>
		<link>http://www.infused.org/2009/01/05/the-blame-game/comment-page-1/#comment-43168</link>
		<dc:creator>Keith</dc:creator>
		<pubDate>Fri, 16 Jan 2009 07:44:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.infused.org/?p=440#comment-43168</guid>
		<description>Stuart,

Sorry, I guess that&#039;s not a well thought out example.  So, again off the top of my head... :-)

You can do something similar to the default behavior.  The default implementation of userstamp_object is:

&lt;pre&gt;&lt;code&gt;def userstamp_object
  User.current_user
end
&lt;/code&gt;&lt;/pre&gt;

This simply requires that you add a class accessor to the model:

&lt;pre&gt;&lt;code&gt;class User &lt; ActiveRecord::Base
  cattr_accessor :current_user
end
&lt;/code&gt;&lt;/pre&gt;

Then, once the user logs in and you have access to the session, you can add a before_filter to ApplicationController:

&lt;pre&gt;&lt;code&gt;class ApplicationController  :logged_in?

  def get_current_user
    User.current_user = User.find(session[:user_id])
  end

  def logged_in?
     !session[:user_id].nil?
  end
end
&lt;/code&gt;&lt;/pre&gt;

I&#039;ll update the post with a better example.  

Cheers,
Keith</description>
		<content:encoded><![CDATA[<p>Stuart,</p>
<p>Sorry, I guess that&#8217;s not a well thought out example.  So, again off the top of my head&#8230; :-)</p>
<p>You can do something similar to the default behavior.  The default implementation of userstamp_object is:</p>
<pre><code>def userstamp_object
  User.current_user
end
</code></pre>
<p>This simply requires that you add a class accessor to the model:</p>
<pre><code>class User &lt; ActiveRecord::Base
  cattr_accessor :current_user
end
</code></pre>
<p>Then, once the user logs in and you have access to the session, you can add a before_filter to ApplicationController:</p>
<pre><code>class ApplicationController  :logged_in?

  def get_current_user
    User.current_user = User.find(session[:user_id])
  end

  def logged_in?
     !session[:user_id].nil?
  end
end
</code></pre>
<p>I&#8217;ll update the post with a better example.  </p>
<p>Cheers,<br />
Keith</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Coyle</title>
		<link>http://www.infused.org/2009/01/05/the-blame-game/comment-page-1/#comment-43145</link>
		<dc:creator>Stuart Coyle</dc:creator>
		<pubDate>Fri, 16 Jan 2009 05:23:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.infused.org/?p=440#comment-43145</guid>
		<description>The code below does not seem to work.
ActiveRecord&#039;s not available at this point. It works in my init.rb...except it would seem that 
the session variable is not available in an ActiveRecord model.
Have I done something wrong? 

&lt;pre&gt;&lt;code&gt;# In environment.rb
class ActiveRecord::Base
  def userstamp_object
    User.find(session[:user_id])
  end
end
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>The code below does not seem to work.<br />
ActiveRecord&#8217;s not available at this point. It works in my init.rb&#8230;except it would seem that<br />
the session variable is not available in an ActiveRecord model.<br />
Have I done something wrong? </p>
<pre><code># In environment.rb
class ActiveRecord::Base
  def userstamp_object
    User.find(session[:user_id])
  end
end
</code></pre>
]]></content:encoded>
	</item>
</channel>
</rss>
