<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.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>Martinicity: Tag safetynet</title>
    <link>http://martinicity.net/articles_controller.rb/tag?tag=safetynet</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Mike Blake</description>
    <item>
      <title>Rails SafetyNet</title>
      <description>&lt;h2&gt;&lt;b&gt;Curent Mood:&lt;/b&gt; Bored with Deleting the Production Database&lt;/h2&gt;

&lt;p&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;I thought I was the only clown working on Rails projects and ignoring the &lt;a href="http://dev.rubyonrails.org/svn/rails/applications/plugins/config/database.example.yml"&gt;warning in config/database.yml&lt;/a&gt; and using rake to wipe out  perfectly good databases.  But I&amp;#8217;ve seen it happen to others now, and enough&amp;#8217;s enough.  So I created the &lt;h3&gt;SafetyNet Plugin&lt;/h3&gt;.&lt;/p&gt;

&lt;p&gt;You can install Safety Net in your app, by running&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
ruby script/plugin install svn://rubyforge.org/var/svn/apptrain/trunk/vendor/plugins/safety_net
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That&amp;#8217;s it. Now, If the &lt;b&gt;test&lt;/b&gt; database points to the same database as &lt;b&gt;development&lt;/b&gt; or &lt;b&gt;production&lt;/b&gt; running rake will display the following message:&lt;/p&gt;

&lt;p&gt;&lt;img src="/images/safety_net.png" alt="safety net"/&gt;&lt;/p&gt;

&lt;pre&gt;
rake aborted! 



The name of your test database matches production or development.
&lt;/pre&gt;

&lt;h3&gt;How it Works&lt;/h3&gt;

&lt;p&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Purging the poor innocent database is prevented in two ways.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;By adding a prerequisite check to the rake script that normaly performs this task.&lt;/li&gt;
&lt;li&gt;By modifying the fixtures method on ActiveRecord to avoid the same fate when running individual tests with the ruby command. &lt;/li&gt;
&lt;/ol&gt;</description>
      <pubDate>Wed, 07 Feb 2007 21:14:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:7d6f994d-0845-41c7-a8ea-09a9157c94db</guid>
      <author>Mike Blake</author>
      <link>http://martinicity.net/articles/2007/02/07/safety-net</link>
      <category>Create</category>
      <category>safetynet</category>
      <category>safetynet</category>
      <category>apptrain</category>
      <category>rails</category>
      <category>plugin</category>
      <category>rake</category>
      <category>rails test database</category>
    </item>
    <item>
      <title>Rails SafetyNet</title>
      <description>&lt;h2&gt;&lt;b&gt;Curent Mood:&lt;/b&gt; Bored with Deleting the Production Database&lt;/h2&gt;

&lt;p&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;I thought I was the only clown working on Rails projects and ignoring the &lt;a href="http://dev.rubyonrails.org/svn/rails/applications/plugins/config/database.example.yml"&gt;warning in config/database.yml&lt;/a&gt; and using rake to wipe out  perfectly good databases.  But I&amp;#8217;ve seen it happen to others now, and enough&amp;#8217;s enough.  So I created the &lt;h3&gt;SafetyNet Plugin&lt;/h3&gt;.&lt;/p&gt;

&lt;p&gt;You can install Safety Net in your app, by running&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
ruby script/plugin install svn://rubyforge.org/var/svn/apptrain/trunk/vendor/plugins/safety_net
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That&amp;#8217;s it. Now, If the &lt;b&gt;test&lt;/b&gt; database points to the same database as &lt;b&gt;development&lt;/b&gt; or &lt;b&gt;production&lt;/b&gt; running rake will display the following message:&lt;/p&gt;

&lt;p&gt;&lt;img src="/images/safety_net.png" alt="safety net"/&gt;&lt;/p&gt;

&lt;pre&gt;
rake aborted! 



The name of your test database matches production or development.
&lt;/pre&gt;

&lt;h3&gt;How it Works&lt;/h3&gt;

&lt;p&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Purging the poor innocent database is prevented in two ways.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;By adding a prerequisite check to the rake script that normaly performs this task.&lt;/li&gt;
&lt;li&gt;By modifying the fixtures method on ActiveRecord to avoid the same fate when running individual tests with the ruby command. &lt;/li&gt;
&lt;/ol&gt;</description>
      <pubDate>Wed, 07 Feb 2007 21:14:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:7d6f994d-0845-41c7-a8ea-09a9157c94db</guid>
      <author>Mike Blake</author>
      <link>http://martinicity.net/articles/2007/02/07/safety-net</link>
      <category>Create</category>
      <category>safetynet</category>
      <category>safetynet</category>
      <category>apptrain</category>
      <category>rails</category>
      <category>plugin</category>
      <category>rake</category>
      <category>rails test database</category>
    </item>
  </channel>
</rss>
