<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>scattrbrain: mysql.rb errors after upgrading ruby</title>
    <link>http://scattrbrain.com/articles/2007/08/09/mysql-rb-errors-after-upgrading-ruby</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Darshan Patil's personal blog</description>
    <item>
      <title>mysql.rb errors after upgrading ruby</title>
      <description>&lt;p&gt;I just noticed that my rails projects broke after I upgraded ruby on my linux box. Projects   that had gems and rails frozen break. This is because of code in the &lt;span class="caps"&gt;SHA1&lt;/span&gt; class not being backward compatible.&lt;/p&gt;


To quickly fix a broken rails app that shows the following error:
&lt;pre&gt;
vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:551:in `initialize'
&lt;/pre&gt;

	&lt;p&gt;edit the mysql.rb file so that the scramble41 routine looks like:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;  &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;scramble41&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;password&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="ident"&gt;message&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
    &lt;span class="keyword"&gt;return&lt;/span&gt; &lt;span class="number"&gt;0x00&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;chr&lt;/span&gt; &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="ident"&gt;password&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;nil?&lt;/span&gt; &lt;span class="keyword"&gt;or&lt;/span&gt; &lt;span class="ident"&gt;password&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;empty?&lt;/span&gt;
    &lt;span class="ident"&gt;buf&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;[&lt;/span&gt;&lt;span class="number"&gt;0x14&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt;
    &lt;span class="ident"&gt;s1&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Digest&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;SHA1&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;digest&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;password&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
    &lt;span class="ident"&gt;s2&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Digest&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;SHA1&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;digest&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;s1&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
    &lt;span class="ident"&gt;x&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Digest&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;SHA1&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;digest&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;message&lt;/span&gt; &lt;span class="punct"&gt;+&lt;/span&gt; &lt;span class="ident"&gt;s2&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
    &lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="punct"&gt;..&lt;/span&gt;&lt;span class="ident"&gt;s1&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;length&lt;/span&gt; &lt;span class="punct"&gt;-&lt;/span&gt; &lt;span class="number"&gt;1&lt;/span&gt;&lt;span class="punct"&gt;).&lt;/span&gt;&lt;span class="ident"&gt;each&lt;/span&gt; &lt;span class="punct"&gt;{|&lt;/span&gt;&lt;span class="ident"&gt;i&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt; &lt;span class="ident"&gt;buf&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;push&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;s1&lt;/span&gt;&lt;span class="punct"&gt;[&lt;/span&gt;&lt;span class="ident"&gt;i&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt; ^ &lt;span class="ident"&gt;x&lt;/span&gt;&lt;span class="punct"&gt;[&lt;/span&gt;&lt;span class="ident"&gt;i&lt;/span&gt;&lt;span class="punct"&gt;])}&lt;/span&gt;
    &lt;span class="ident"&gt;buf&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;pack&lt;/span&gt;&lt;span class="punct"&gt;(&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;C*&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;)&lt;/span&gt;
  &lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
      <pubDate>Thu, 09 Aug 2007 01:34:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:3c174c21-b10b-42aa-8b44-d5aa9c45334b</guid>
      <author>dapatil@scattrbrain.com (Darshan Patil)</author>
      <link>http://scattrbrain.com/articles/2007/08/09/mysql-rb-errors-after-upgrading-ruby</link>
      <category>Ruby</category>
      <category>Programming</category>
      <category>ruby</category>
      <category>mysql</category>
      <trackback:ping>http://scattrbrain.com/articles/trackback/186</trackback:ping>
    </item>
    <item>
      <title>"mysql.rb errors after upgrading ruby" by jason</title>
      <description>&lt;p&gt;worked!&lt;/p&gt;</description>
      <pubDate>Wed, 30 Jan 2008 03:09:41 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:cc928e08-83ce-4e51-88c0-807e0fe203b7</guid>
      <link>http://scattrbrain.com/articles/2007/08/09/mysql-rb-errors-after-upgrading-ruby#comment-271</link>
    </item>
    <item>
      <title>"mysql.rb errors after upgrading ruby" by Neil</title>
      <description>&lt;p&gt;Like the rest, thanks.&lt;/p&gt;</description>
      <pubDate>Tue, 15 Jan 2008 22:46:09 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:eab7b7c9-687a-4d57-970d-7568ec26051e</guid>
      <link>http://scattrbrain.com/articles/2007/08/09/mysql-rb-errors-after-upgrading-ruby#comment-269</link>
    </item>
    <item>
      <title>"mysql.rb errors after upgrading ruby" by Rick K</title>
      <description>&lt;p&gt;I was installing Mephisto and hit this &amp;#8211; voila!&lt;/p&gt;


	&lt;p&gt;Thank you!&lt;/p&gt;</description>
      <pubDate>Sun, 13 Jan 2008 23:07:37 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:27267c11-7448-4152-8db8-0c87ea4b8aba</guid>
      <link>http://scattrbrain.com/articles/2007/08/09/mysql-rb-errors-after-upgrading-ruby#comment-268</link>
    </item>
    <item>
      <title>"mysql.rb errors after upgrading ruby" by mj</title>
      <description>&lt;p&gt;I tried this but now I get a different error:  MySQL Connection dropped during query&amp;#8230;.anyone see anything like that?  What version of Ruby did you upgrade to that caused this error?&lt;/p&gt;</description>
      <pubDate>Tue, 23 Oct 2007 08:34:57 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:6717de16-25f1-4e68-8d0f-ef63856864f8</guid>
      <link>http://scattrbrain.com/articles/2007/08/09/mysql-rb-errors-after-upgrading-ruby#comment-208</link>
    </item>
    <item>
      <title>"mysql.rb errors after upgrading ruby" by Snorri</title>
      <description>&lt;p&gt;Thanke you so much!&lt;/p&gt;</description>
      <pubDate>Tue, 23 Oct 2007 06:37:44 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:115a5665-92da-44fd-ab1c-c317b1995eb5</guid>
      <link>http://scattrbrain.com/articles/2007/08/09/mysql-rb-errors-after-upgrading-ruby#comment-207</link>
    </item>
    <item>
      <title>"mysql.rb errors after upgrading ruby" by Set</title>
      <description>&lt;p&gt;aaaaaaaaaaaaa, man, I had the same problem! I&amp;#8217;m not alone! :)&lt;/p&gt;</description>
      <pubDate>Fri, 14 Sep 2007 18:32:03 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:0d02e893-5620-48f9-99da-5b741ec12e0c</guid>
      <link>http://scattrbrain.com/articles/2007/08/09/mysql-rb-errors-after-upgrading-ruby#comment-189</link>
    </item>
    <item>
      <title>"mysql.rb errors after upgrading ruby" by Tina</title>
      <description>&lt;p&gt;Man you don&amp;#8217;t even know how long I&amp;#8217;ve waited for this since disabling my own Movable Type widget (that doesn&amp;#8217;t work since Haloscan bypasses that code).&lt;/p&gt;


	&lt;p&gt;THANK YOU!&lt;/p&gt;</description>
      <pubDate>Mon, 10 Sep 2007 13:17:11 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:9823d135-c173-4ca2-9e97-baf70a8ce3ec</guid>
      <link>http://scattrbrain.com/articles/2007/08/09/mysql-rb-errors-after-upgrading-ruby#comment-187</link>
    </item>
  </channel>
</rss>
