<?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: Can&#8217;t dup NilClass&#8230; maybe try `unloadable`</title>
	<atom:link href="http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/feed/" rel="self" type="application/rss+xml" />
	<link>http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/</link>
	<description>It is beyond anything you have ever experienced or imagined</description>
	<lastBuildDate>Tue, 10 Jan 2012 02:01:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Rafael</title>
		<link>http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/comment-page-1/#comment-10126</link>
		<dc:creator>Rafael</dc:creator>
		<pubDate>Wed, 24 Aug 2011 18:49:32 +0000</pubDate>
		<guid isPermaLink="false">http://strd6.com/?p=250#comment-10126</guid>
		<description>Wao! thanks a lot for this post... you save my day.. I was suffering with this problem</description>
		<content:encoded><![CDATA[<p>Wao! thanks a lot for this post&#8230; you save my day.. I was suffering with this problem</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sorrow</title>
		<link>http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/comment-page-1/#comment-8971</link>
		<dc:creator>Sorrow</dc:creator>
		<pubDate>Tue, 21 Jun 2011 11:28:16 +0000</pubDate>
		<guid isPermaLink="false">http://strd6.com/?p=250#comment-8971</guid>
		<description>The comment by Evan saved my day! 

I had the same error when using self.inherited.  ActiveRecord::Base also defines this method, not only included - calling super solved the problem with &quot;can&#039;t dup NilClass&quot;. Great post, thanks.</description>
		<content:encoded><![CDATA[<p>The comment by Evan saved my day! </p>
<p>I had the same error when using self.inherited.  ActiveRecord::Base also defines this method, not only included &#8211; calling super solved the problem with &#8220;can&#8217;t dup NilClass&#8221;. Great post, thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eddroid</title>
		<link>http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/comment-page-1/#comment-8014</link>
		<dc:creator>eddroid</dc:creator>
		<pubDate>Wed, 01 Jun 2011 05:01:44 +0000</pubDate>
		<guid isPermaLink="false">http://strd6.com/?p=250#comment-8014</guid>
		<description>Solution similar to Nathan Hyde&#039;s above:

Rails 2.3.5

Problem: Dev mode wants to reload before every request.  Rails initialization gets messed up when reloading code from plugins and monkeypatches.  The plugin or patch isn&#039;t loaded at all or, if it is, things that you expect to be defined at reload time aren&#039;t.

My case: monkeypatching the Tag model in acts_as_taggable_on_steroids to add a has_many association

Solution: Wrap the monkeypatch code in:

require &#039;dispatcher&#039;
Dispatcher.to_prepare do
  Tag.class_eval do
    # patches
  end
end

Resources:
http://stackoverflow.com/questions/2397740/how-to-extend-an-unloadable-rails-plugin
http://www.oliyiptong.com/blog/2008/08/22/rails-to_prepare-executing-code-before-each-request/

Just another option in case you don&#039;t want to edit environment.rb.</description>
		<content:encoded><![CDATA[<p>Solution similar to Nathan Hyde&#8217;s above:</p>
<p>Rails 2.3.5</p>
<p>Problem: Dev mode wants to reload before every request.  Rails initialization gets messed up when reloading code from plugins and monkeypatches.  The plugin or patch isn&#8217;t loaded at all or, if it is, things that you expect to be defined at reload time aren&#8217;t.</p>
<p>My case: monkeypatching the Tag model in acts_as_taggable_on_steroids to add a has_many association</p>
<p>Solution: Wrap the monkeypatch code in:</p>
<p>require &#8216;dispatcher&#8217;<br />
Dispatcher.to_prepare do<br />
  Tag.class_eval do<br />
    # patches<br />
  end<br />
end</p>
<p>Resources:<br />
<a href="http://stackoverflow.com/questions/2397740/how-to-extend-an-unloadable-rails-plugin" rel="nofollow">http://stackoverflow.com/questions/2397740/how-to-extend-an-unloadable-rails-plugin</a><br />
<a href="http://www.oliyiptong.com/blog/2008/08/22/rails-to_prepare-executing-code-before-each-request/" rel="nofollow">http://www.oliyiptong.com/blog/2008/08/22/rails-to_prepare-executing-code-before-each-request/</a></p>
<p>Just another option in case you don&#8217;t want to edit environment.rb.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RailsEngines 2.3 &#124; XykoX</title>
		<link>http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/comment-page-1/#comment-7090</link>
		<dc:creator>RailsEngines 2.3 &#124; XykoX</dc:creator>
		<pubDate>Sat, 30 Apr 2011 11:35:02 +0000</pubDate>
		<guid isPermaLink="false">http://strd6.com/?p=250#comment-7090</guid>
		<description>[...] heureusement, d’autres sont passé par là et certains ont déjà résolu le problème en ajoutant un unloadable dans la classe [...]</description>
		<content:encoded><![CDATA[<p>[...] heureusement, d’autres sont passé par là et certains ont déjà résolu le problème en ajoutant un unloadable dans la classe [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Diana</title>
		<link>http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/comment-page-1/#comment-5878</link>
		<dc:creator>Diana</dc:creator>
		<pubDate>Mon, 28 Feb 2011 20:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://strd6.com/?p=250#comment-5878</guid>
		<description>The &quot;Can&#039;t dup NilClass&quot; error can also happen with Time.parse when you pass in a nil value:

oh_noes = nil
Time.parse(oh_noes)

I assume the parse method dupes the value to make sure it doesn&#039;t modify yours, hence the error.

This is what caused ours. :) Likewise I assume any method that tries to dup without checking for nil first will throw this.</description>
		<content:encoded><![CDATA[<p>The &#8220;Can&#8217;t dup NilClass&#8221; error can also happen with Time.parse when you pass in a nil value:</p>
<p>oh_noes = nil<br />
Time.parse(oh_noes)</p>
<p>I assume the parse method dupes the value to make sure it doesn&#8217;t modify yours, hence the error.</p>
<p>This is what caused ours. <img src='http://strd6.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Likewise I assume any method that tries to dup without checking for nil first will throw this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/comment-page-1/#comment-4603</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Fri, 05 Nov 2010 09:54:02 +0000</pubDate>
		<guid isPermaLink="false">http://strd6.com/?p=250#comment-4603</guid>
		<description>I just ran into the &#039;A copy of ApplicationController has been removed from the module tree but is still active!&#039; problem using Rails 2.3.8 and BrowserCMS 3.1.2.
As soon as I was calling ApplicationController&#039;s methods from my custom controllers, the exception would occur.

&lt;a href=&quot;#comment-370&quot; rel=&quot;nofollow&quot;&gt;Paul&#039;s&lt;/a&gt; solution works nicely for me. 

&lt;blockquote&gt;
&lt;a href=&quot;#comment-370&quot; rel=&quot;nofollow&quot;&gt;
&lt;strong&gt;&lt;em&gt;Paul:&lt;/em&gt;&lt;/strong&gt;
&lt;/a&gt;
Second, you could put something like this in your application’s environment.rb file:
&lt;code&gt;config.reload_plugins = true if RAILS_ENV == ‘development’&lt;/code&gt;
&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<p>I just ran into the &#8216;A copy of ApplicationController has been removed from the module tree but is still active!&#8217; problem using Rails 2.3.8 and BrowserCMS 3.1.2.<br />
As soon as I was calling ApplicationController&#8217;s methods from my custom controllers, the exception would occur.</p>
<p><a href="#comment-370" rel="nofollow">Paul&#8217;s</a> solution works nicely for me. </p>
<blockquote><p>
<a href="#comment-370" rel="nofollow"><br />
<strong><em>Paul:</em></strong><br />
</a><br />
Second, you could put something like this in your application’s environment.rb file:<br />
<code>config.reload_plugins = true if RAILS_ENV == ‘development’</code>
</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abdo</title>
		<link>http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/comment-page-1/#comment-3892</link>
		<dc:creator>Abdo</dc:creator>
		<pubDate>Sun, 01 Aug 2010 09:22:52 +0000</pubDate>
		<guid isPermaLink="false">http://strd6.com/?p=250#comment-3892</guid>
		<description>I used Kris fix in the plugin init.rb and it fixed the problem and the &quot;A copy of ApplicationController has been removed from the module tree but is still active!&quot; has gone.
Thanks Kris &amp; Daniel</description>
		<content:encoded><![CDATA[<p>I used Kris fix in the plugin init.rb and it fixed the problem and the &#8220;A copy of ApplicationController has been removed from the module tree but is still active!&#8221; has gone.<br />
Thanks Kris &amp; Daniel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan Hyde</title>
		<link>http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/comment-page-1/#comment-2603</link>
		<dc:creator>Nathan Hyde</dc:creator>
		<pubDate>Tue, 01 Jun 2010 18:56:46 +0000</pubDate>
		<guid isPermaLink="false">http://strd6.com/?p=250#comment-2603</guid>
		<description>Just wanted to add yet another method of addressing this issue (when all the others don&#039;t seem to work for you). Credit goes to James Adam for pointing me in the right direction and the comments in this article.

See http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/f54f18f4d4354926?pli=1 for an explanation.

In environment.rb:
&lt;code&gt;
Rails::Initializer.run do &#124;config&#124;
  # etc 
  config.to_prepare do
    # use load to ensure the added functionality is actually evaluated every time
    load &#039;path/to/your/extension.rb&#039;
  end
end
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Just wanted to add yet another method of addressing this issue (when all the others don&#8217;t seem to work for you). Credit goes to James Adam for pointing me in the right direction and the comments in this article.</p>
<p>See <a href="http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/f54f18f4d4354926?pli=1" rel="nofollow">http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/f54f18f4d4354926?pli=1</a> for an explanation.</p>
<p>In environment.rb:<br />
<code><br />
Rails::Initializer.run do |config|<br />
  # etc<br />
  config.to_prepare do<br />
    # use load to ensure the added functionality is actually evaluated every time<br />
    load 'path/to/your/extension.rb'<br />
  end<br />
end<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel X Moore</title>
		<link>http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/comment-page-1/#comment-1763</link>
		<dc:creator>Daniel X Moore</dc:creator>
		<pubDate>Fri, 26 Mar 2010 17:50:58 +0000</pubDate>
		<guid isPermaLink="false">http://strd6.com/?p=250#comment-1763</guid>
		<description>Thanks Evan! That&#039;s a better explanation and makes a lot of sense. I&#039;ll try it that way the next time I encounter the issue.</description>
		<content:encoded><![CDATA[<p>Thanks Evan! That&#8217;s a better explanation and makes a lot of sense. I&#8217;ll try it that way the next time I encounter the issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kris</title>
		<link>http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/comment-page-1/#comment-1762</link>
		<dc:creator>Kris</dc:creator>
		<pubDate>Fri, 26 Mar 2010 13:44:27 +0000</pubDate>
		<guid isPermaLink="false">http://strd6.com/?p=250#comment-1762</guid>
		<description>@Fred - in my case the init.rb in my plugin as that is where I was getting the error. It maybe different if you are getting the error for your Rails app itself...</description>
		<content:encoded><![CDATA[<p>@Fred &#8211; in my case the init.rb in my plugin as that is where I was getting the error. It maybe different if you are getting the error for your Rails app itself&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

