<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Live &#38; Code &#187; YARD</title>
	<atom:link href="http://www.liveandcode.com/tag/yard/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.liveandcode.com</link>
	<description>Enrico on programming, living, and everything in between</description>
	<lastBuildDate>Mon, 27 Jun 2011 01:10:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>A Rails Puzzler</title>
		<link>http://www.liveandcode.com/2009/07/29/a-rails-puzzler/</link>
		<comments>http://www.liveandcode.com/2009/07/29/a-rails-puzzler/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 18:40:27 +0000</pubDate>
		<dc:creator>Enrico</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[YARD]]></category>

		<guid isPermaLink="false">http://www.liveandcode.com/?p=166</guid>
		<description><![CDATA[While I refuse to call this &#8220;magic&#8221;, the following has been confusing me for a long time now and I&#8217;ve finally decided to post it to my blog and see if anyone else gets it. It turns out that ActiveScaffold and YARD don&#8217;t play nice together. In particular, if YARD has previously been loaded (say, [...]]]></description>
			<content:encoded><![CDATA[<p>While I refuse to call this &#8220;magic&#8221;, the following has been confusing me for a long time now and I&#8217;ve finally decided to post it to my blog and see if anyone else gets it.</p>
<p>It turns out that <a href="http://activescaffold.com/">ActiveScaffold</a> and <a href="http://yard.soen.ca/">YARD</a> don&#8217;t play nice together. In particular, if YARD has previously been loaded (say, to define a Rake task for it), ActiveScaffold initialization will fail with the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">uninitialized constant <span style="color:#6666ff; font-weight:bold;">Helpers::ControllerHelpers</span></pre></div></div>

<p>Using <code>--trace</code> and following the source code, I find out that this is happening during ActiveScaffold&#8217;s initialization, particularly at this statement:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">ActionController::Base</span>.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span>:<span style="color:#9966CC; font-weight:bold;">include</span>, <span style="color:#6666ff; font-weight:bold;">ActiveScaffold::Helpers::ControllerHelpers</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Debugging the ActiveScaffold initialization code yields this baffling result:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveScaffold::Helpers</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> Helpers
<span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveScaffold::Helpers::ControllerHelpers</span>
<span style="color:#CC00FF; font-weight:bold;">NameError</span>: uninitialized constant <span style="color:#6666ff; font-weight:bold;">ActiveScaffold::Helpers</span></pre></div></div>

<p>It&#8217;s the weirdest thing that I&#8217;ve seen since I became a Rubyist and it is blocking me from using YARD to generate the documentation for my current Rails project. Unfortunately, cutting out ActiveScaffold isn&#8217;t going to fly because the deadline for initial release is so close and so much functionality is implemented using it already. It wasn&#8217;t my choice; if I had my way, I might never use ActiveScaffold ever again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liveandcode.com/2009/07/29/a-rails-puzzler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

