<?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>imarichardson.com &#187; ruby</title>
	<atom:link href="http://www.imarichardson.com/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.imarichardson.com</link>
	<description>I&#039;m a Richardson. Are you?</description>
	<lastBuildDate>Fri, 25 Mar 2011 16:06:46 +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>Code Woes: &#8220;undefined local variable or method `version_requirements&#8217;&#8221;</title>
		<link>http://www.imarichardson.com/2011/03/25/code-woes-undefined-local-variable-or-method-version_requirements/</link>
		<comments>http://www.imarichardson.com/2011/03/25/code-woes-undefined-local-variable-or-method-version_requirements/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 15:34:59 +0000</pubDate>
		<dc:creator>Saeed Richardson</dc:creator>
				<category><![CDATA[Code Woes]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[code woes]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.imarichardson.com/?p=19</guid>
		<description><![CDATA[Deciding to install rvm on my development laptop (because I need Ruby 1.9 to work with the latest release of SproutCore), I suddenly find myself receiving the dreaded &#8220;version_requirements&#8221; error when running a 2.3.x rails application. In all of its glory : undefined local variable or method `version_requirements' for # /Users/imarichardson/.rvm/gems/ruby-1.9.2-p180/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:in `requirement' /Users/imarichardson/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:269:in `search' /Users/imarichardson/.rvm/gems/ruby-1.9.2-p180/gems/rails-2.3.5/lib/rails/vendor_gem_source_index.rb:119:in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/sybrenstuvel/2468506922/" title="Frustration (was: threesixtyfive | day 244) by Sybren A. Stüvel, on Flickr"><img src="http://farm3.static.flickr.com/2410/2468506922_c1ed495959_m.jpg" width="240" height="196" alt="Frustration (was: threesixtyfive | day 244)" /></a></p>
<p>Deciding to install rvm on my development laptop (because I need Ruby 1.9 to work with the latest release of SproutCore), I suddenly find myself receiving the dreaded &#8220;version_requirements&#8221; error when running a 2.3.x rails application. In all of its glory :</p>
<p><pre  class="brush:ruby">
undefined local variable or method `version_requirements' for #<Rails::GemDependency:0x0000010095b248>
/Users/imarichardson/.rvm/gems/ruby-1.9.2-p180/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:in `requirement'
/Users/imarichardson/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:269:in `search'
/Users/imarichardson/.rvm/gems/ruby-1.9.2-p180/gems/rails-2.3.5/lib/rails/vendor_gem_source_index.rb:119:in `search'
/Users/imarichardson/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:247:in `activate'
/Users/imarichardson/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1276:in `gem'
/Users/imarichardson/.rvm/gems/ruby-1.9.2-p180/gems/rails-2.3.5/lib/rails/gem_dependency.rb:73:in `add_load_paths'
/Users/imarichardson/.rvm/gems/ruby-1.9.2-p180/gems/rails-2.3.5/lib/initializer.rb:301:in `block in add_gem_load_paths'
/Users/imarichardson/.rvm/gems/ruby-1.9.2-p180/gems/rails-2.3.5/lib/initializer.rb:301:in `each'
/Users/imarichardson/.rvm/gems/ruby-1.9.2-p180/gems/rails-2.3.5/lib/initializer.rb:301:in `add_gem_load_paths'
/Users/imarichardson/.rvm/gems/ruby-1.9.2-p180/gems/rails-2.3.5/lib/initializer.rb:132:in `process'
/Users/imarichardson/.rvm/gems/ruby-1.9.2-p180/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
</pre>
</p>
<p>So through the power of Google I come upon <a href="http://excid3.com/blog/2011/02/undefined-local-variable-or-method-version_requirements-for-nameerror/" _mce_href="http://excid3.com/blog/2011/02/undefined-local-variable-or-method-version_requirements-for-nameerror/" style="">this post from Chris Oliver</a>, and just as I&#8217;m about to rollback my version of Ruby to a previous one, I check the <a href="https://gist.github.com/807008#gistcomment-20117" _mce_href="https://gist.github.com/807008#gistcomment-20117" style="">source</a> and see an even better solution in <a href="http://www.redmine.org/issues/7516#note-3">this discussion thread</a>. Instead of rolling back ruby gems and making everyone suffer, you can add a non-intrusive update to your environment.rb file. Add this block in right before the initialization and all will be well:</p>
<pre class="brush:ruby">if Gem::VERSION &gt;= "1.3.6"
    module Rails
        class GemDependency
            def requirement
                r = super
                (r == Gem::Requirement.default) ? nil : r
            end
        end
    end
end</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.imarichardson.com/2011/03/25/code-woes-undefined-local-variable-or-method-version_requirements/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

