<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Continuous Thinking - Home</title>
  <id>tag:continuousthinking.com,2008:mephisto/</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  <link href="http://continuousthinking.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://continuousthinking.com/" rel="alternate" type="text/html"/>
  <updated>2008-08-16T14:19:03Z</updated>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-08-16:562</id>
    <published>2008-08-16T14:17:00Z</published>
    <updated>2008-08-16T14:19:03Z</updated>
    <link href="http://continuousthinking.com/2008/8/16/ar-extensions-0-8-0-forgot-to-mention" rel="alternate" type="text/html"/>
    <title>ar-extensions 0.8.0, forgot to mention</title>
<content type="html">
            &lt;p&gt;I forgot to mention that ar-extensions no longer loads adapter specific functionality by itself. You need to tell it what you want. For example if you want to load import functionality for MySQL you&#8217;d have to require the right files, like so:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;require &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;ar-extensions/adapters/mysql&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;require &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;ar-extensions/import/mysql&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;Sorry about that.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-08-06:558</id>
    <published>2008-08-06T19:46:00Z</published>
    <updated>2008-08-07T05:58:02Z</updated>
    <link href="http://continuousthinking.com/2008/8/6/ar-extensions-0-8-0-released" rel="alternate" type="text/html"/>
    <title>ar-extensions 0.8.0 released!</title>
<content type="html">
            &lt;p&gt;ar-extensions 0.8.0 is finally released! All known bugs and compatibility issues with Rails 2.1.0 have been resolved.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;0.8.0 does not work with the latest Rails edge due to some additional features on edge that weren&#8217;t in 2.1.0&lt;/li&gt;
		&lt;li&gt;0.8.0 should not be used with Rails 2.0.2 or below&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;If any feature requests or bugs please report them on &lt;a href='http://zdennis.lighthouseapp.com/projects/14379-ar-extensions'&gt;lighthouse&lt;/a&gt;&lt;/p&gt;


	&lt;h2&gt;Installing&lt;/h2&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;gem install ar-extensions&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;h2&gt;Oracle and PostgreSQL users&lt;/h2&gt;


	&lt;p&gt;If you&#8217;re using ar-extensions 0.7.0 with Oracle or PostgreSQL I am very interested to find out if 0.8.0 works fine. I don&#8217;t have Oracle, and I&#8217;m not a PostgreSQL user. If you&#8217;re interested in running the test suite against one of those databases please let me know.&lt;/p&gt;


	&lt;p&gt;Thanks for your patience and enjoy!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-08-01:557</id>
    <published>2008-08-01T15:21:00Z</published>
    <updated>2008-08-01T19:24:03Z</updated>
    <link href="http://continuousthinking.com/2008/8/1/cheat-execute" rel="alternate" type="text/html"/>
    <title>cheat --execute</title>
<content type="html">
            &lt;p&gt;I hate having to continuously lookup the steps to install things every few weeks. The cheat gem works for most things to find installation instructions relatively quickly, but sometimes I just want to install something, not necessarily have to search through lines of example usage to find the installation instructions. Enter two new options for the cheat gem: dash x and dash dash execute. It&#8217;s simple. For example:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;cd &lt;span class='rx'&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='k'&gt;some&lt;/span&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;/span&gt;dummy/rails/project&lt;tt&gt;
&lt;/tt&gt;cheat install_rspec_rails -x&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='c'&gt;# This is to install the latest rspec/rspec-rails into &lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='c'&gt;# a rails project. &lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  script/plugin install git&lt;span class='sy'&gt;:/&lt;/span&gt;/github.com/dchelimsky/rspec.git&lt;tt&gt;
&lt;/tt&gt;  script/plugin install git&lt;span class='sy'&gt;:/&lt;/span&gt;/github.com/dchelimsky/rspec-rails.git&lt;tt&gt;
&lt;/tt&gt;  script/generate rspec&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='co'&gt;Would&lt;/span&gt; you like to execute the above sheet? (&lt;span class='co'&gt;Y&lt;/span&gt;/&lt;span class='co'&gt;N&lt;/span&gt;)&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;I&#8217;ve sent defunkt a pull request on github, I hope it includes the change. Until then, the change is only on my fork: http://github.com/zdennis/cheat/tree/master&lt;/p&gt;


	&lt;p&gt;To install do the following:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;git clone git://github.com/zdennis/cheat.git&lt;tt&gt;
&lt;/tt&gt;cd cheat&lt;tt&gt;
&lt;/tt&gt;rake package&lt;tt&gt;
&lt;/tt&gt;sudo gem install pkg/cheat-1.2.2.gem&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;Enjoy,&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-07-18:553</id>
    <published>2008-07-18T01:41:00Z</published>
    <updated>2008-07-18T05:42:38Z</updated>
    <link href="http://continuousthinking.com/2008/7/18/ar-extensions-rails-2-x-followup" rel="alternate" type="text/html"/>
    <title>ar-extensions, Rails 2.x followup</title>
<content type="html">
            &lt;p&gt;First things first, ar-extensions moved to Lighthouse and Github. So please no more tickets or patches on rubyforge. I&#8217;ll close out or move over the ones on rubyforge that currently reside there.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href='http://zdennis.lighthouseapp.com/projects/14379-ar-extensions/overview'&gt;ar-extensions at Lighthouse&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href='http://github.com/zdennis/ar-extensions/tree/master'&gt;ar-extensions at GitHub&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Now, the fun stuff.&lt;/p&gt;


	&lt;h3&gt;ar-extensions and Rails 2.x compability&lt;/h3&gt;


	&lt;p&gt;For the most part ar-extensions 0.7.0 (and below) is not compatible with Rails 2.0.x and 2.1. The import functionality works, but ar-extensions will bork on some edge cases of using ActiveRecord::Base.find methods. It won&#8217;t return the wrong value, it will simply raise an exception. So if you&#8217;re using ar-extensions in your Rails 2.x app, the app itself will probably bork (and I realize that you probably already know this). If you&#8217;re using the import functionality in isolation then you should be fine.&lt;/p&gt;


	&lt;p&gt;Some of the loading issues with ar-extensions that people had are due to ar-extensions being loaded during the time that Rails goes through the loading process (if you put require &#8216;ar-extensions&#8217; in config/environments/development.rb, test.rb or production.rb). You can get around this by moving if after the Rails::Initializer.run block in your config/environment.rb file.&lt;/p&gt;


	&lt;p&gt;Tonight I made several commits to get ar-extensions closer to Rails 2.1.0 compatibility. &lt;span class='caps'&gt;HEAD&lt;/span&gt; right now is Rails 2.0.1 compatible, but not 2.0.2 or 2.1.0 compatible. As soon as ar-extensions is compatible I will release 0.8.0. I am hoping for it to be released within the next few days. And by compatible I mean that ar-extensions not only passes its own tests, but it also doesn&#8217;t break any of ActiveRecord&#8217;s tests.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-07-17:551</id>
    <published>2008-07-17T14:29:00Z</published>
    <updated>2008-07-17T15:53:17Z</updated>
    <link href="http://continuousthinking.com/2008/7/17/using-seed-data-with-rspec-stories" rel="alternate" type="text/html"/>
    <title>Using Seed Data with RSpec Stories</title>
<content type="html">
            &lt;p&gt;Yesterday I needed to introduce seed data into our application. In order for our story suite to continue to run I needed to populate seed data into the testing environment when the stories ran. I didn&#8217;t want to  use the production seed data in my test environment, but I wanted to keep things simple.  I am already using using &lt;a href='http://github.com/mbleigh/seed-fu/tree'&gt;seed_fu&lt;/a&gt; from Michael Bleigh to handle the seed data for production. Why not leverage it for stories as well?&lt;/p&gt;


	&lt;p&gt;I made a minor modification to the task to support passing in an argument to rake or setting an environment variable so you can load &#8220;fixtures&#8221; from a different directory. In my &#8220;stories/helper.rb&#8221; file I have added near the top:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;system &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;rake db:seed FIXTURE_PATH=stories/fixtures&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;This loads the seed data from &#8220;RAILS_ROOT/stories/fixtures&#8221;. Here&#8217;s the modified seed_fu rake task:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;namespace &lt;span class='sy'&gt;:db&lt;/span&gt; &lt;span class='r'&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  desc &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;Loads seed data from db/fixtures for the current environment.&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  task &lt;span class='sy'&gt;:seed&lt;/span&gt; =&amp;gt; &lt;span class='sy'&gt;:environment&lt;/span&gt; &lt;span class='r'&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    fixture_path = &lt;span class='co'&gt;ENV&lt;/span&gt;[&lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;FIXTURE_PATH&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;] ? &lt;span class='co'&gt;ENV&lt;/span&gt;[&lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;FIXTURE_PATH&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;] : &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;db/fixtures&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='co'&gt;Dir&lt;/span&gt;[&lt;span class='co'&gt;File&lt;/span&gt;.join(&lt;span class='co'&gt;RAILS_ROOT&lt;/span&gt;, fixture_path, &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;*.rb&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;)].sort.each { |fixture| &lt;tt&gt;
&lt;/tt&gt;      puts &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='ch'&gt;\n&lt;/span&gt;&lt;span class='k'&gt;== Seeding from &lt;/span&gt;&lt;span class='il'&gt;&lt;span class='dl'&gt;#{&lt;/span&gt;&lt;span class='co'&gt;File&lt;/span&gt;.split(fixture).last&lt;span class='dl'&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class='k'&gt; &lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; + \&lt;tt&gt;
&lt;/tt&gt;         (&lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;=&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; * (&lt;span class='i'&gt;60&lt;/span&gt; - (&lt;span class='i'&gt;17&lt;/span&gt; + &lt;span class='co'&gt;File&lt;/span&gt;.split(fixture).last.length)))&lt;tt&gt;
&lt;/tt&gt;      load fixture &lt;tt&gt;
&lt;/tt&gt;      puts &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;=&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; * &lt;span class='i'&gt;60&lt;/span&gt; + &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='ch'&gt;\n&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    }&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='co'&gt;Dir&lt;/span&gt;[&lt;span class='co'&gt;File&lt;/span&gt;.join(&lt;span class='co'&gt;RAILS_ROOT&lt;/span&gt;, fixture_path, &lt;span class='co'&gt;RAILS_ENV&lt;/span&gt;, &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;*.rb&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;)].sort.each { |fixture| &lt;tt&gt;
&lt;/tt&gt;      puts &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='ch'&gt;\n&lt;/span&gt;&lt;span class='k'&gt;== [&lt;/span&gt;&lt;span class='il'&gt;&lt;span class='dl'&gt;#{&lt;/span&gt;&lt;span class='co'&gt;RAILS_ENV&lt;/span&gt;&lt;span class='dl'&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class='k'&gt;] Seeding from &lt;/span&gt;&lt;span class='il'&gt;&lt;span class='dl'&gt;#{&lt;/span&gt;&lt;span class='co'&gt;File&lt;/span&gt;.split(fixture).last&lt;span class='dl'&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class='k'&gt; &lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; + \&lt;tt&gt;
&lt;/tt&gt;          (&lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;=&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; * (&lt;span class='i'&gt;60&lt;/span&gt; - (&lt;span class='i'&gt;20&lt;/span&gt; + &lt;span class='co'&gt;File&lt;/span&gt;.split(fixture).last.length + &lt;span class='co'&gt;RAILS_ENV&lt;/span&gt;.length)))&lt;tt&gt;
&lt;/tt&gt;      load fixture &lt;tt&gt;
&lt;/tt&gt;      puts &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;=&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; * &lt;span class='i'&gt;60&lt;/span&gt; + &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='ch'&gt;\n&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    }&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='r'&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;After this my seed data was resembling the typical format:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;&lt;span class='co'&gt;ExpenseCategory&lt;/span&gt;.transaction &lt;span class='r'&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='co'&gt;ExpenseCategory&lt;/span&gt;.seed(&lt;span class='sy'&gt;:object_code&lt;/span&gt;) &lt;span class='r'&gt;do&lt;/span&gt; |s|&lt;tt&gt;
&lt;/tt&gt;     s.object_code = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;1234&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;     s.name = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;Foo&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='co'&gt;ExpenseCategory&lt;/span&gt;.seed(&lt;span class='sy'&gt;:object_code&lt;/span&gt;) &lt;span class='r'&gt;do&lt;/span&gt; |s|&lt;tt&gt;
&lt;/tt&gt;     s.object_code = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;1235&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;     s.name = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;Bar&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='co'&gt;ExpenseCategory&lt;/span&gt;.seed(&lt;span class='sy'&gt;:object_code&lt;/span&gt;) &lt;span class='r'&gt;do&lt;/span&gt; |s|&lt;tt&gt;
&lt;/tt&gt;     s.object_code = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;1236&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;     s.name = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;Baz&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='r'&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;And while I like this it&#8217;s a little verbose. So I modified seed_fu to introduce the &lt;strong&gt;seed_many&lt;/strong&gt; method to consolidate that:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;&lt;span class='co'&gt;ExpenseCategory&lt;/span&gt;.transaction &lt;span class='r'&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='co'&gt;ExpenseCategory&lt;/span&gt;.seed_many(&lt;span class='sy'&gt;:object_code&lt;/span&gt;, [&lt;tt&gt;
&lt;/tt&gt;     { &lt;span class='sy'&gt;:object_code&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;1234&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class='sy'&gt;:name&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;Foo&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;},&lt;tt&gt;
&lt;/tt&gt;     { &lt;span class='sy'&gt;:object_code&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;1235&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class='sy'&gt;:name&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;Bar&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;},&lt;tt&gt;
&lt;/tt&gt;     { &lt;span class='sy'&gt;:object_code&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;1236&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class='sy'&gt;:name&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;Baz&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;}&lt;tt&gt;
&lt;/tt&gt;  ])&lt;tt&gt;
&lt;/tt&gt;&lt;span class='r'&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;It maintains a simple &lt;span class='caps'&gt;API&lt;/span&gt; and highly readable seed data. I&#8217;ve committed this to my fork of seed_fu, and am hoping that Michael accepts the patch and adds it to seed_fu.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;The patch for the rake &lt;span class='caps'&gt;FIXTURE&lt;/span&gt;_PATH: &lt;a href='http://github.com/zdennis/seed-fu/commit/4d391aa214c369f161e37c194b07d49e55312b35'&gt;http://github.com/zdennis/seed-fu/commit/4d391aa214c369f161e37c194b07d49e55312b35&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;The patch to add the seed_many method: &lt;a href='http://github.com/zdennis/seed-fu/commit/9f7e8b27b7cb175911474a898ea282771ab2a5c3'&gt;http://github.com/zdennis/seed-fu/commit/9f7e8b27b7cb175911474a898ea282771ab2a5c3&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-07-17:552</id>
    <published>2008-07-17T02:34:00Z</published>
    <updated>2008-07-17T02:40:42Z</updated>
    <link href="http://continuousthinking.com/2008/7/17/ar-extensions-rails-2-x" rel="alternate" type="text/html"/>
    <title>ar-extensions, Rails 2.x</title>
<content type="html">
            &lt;p&gt;There are some issues with ar-extensions and Rails 2.x.  At first glance it mainly has to do with load order and what to load. I&#8217;m going to try to post an update or at least instructions tomorrow so people can use ar-extensions with Rails 2.x and up.&lt;/p&gt;


	&lt;p&gt;I&#8217;m going to be moving the codebase to github and will start work on ar-extensions to get closer to a 1.0 release later this fall. I plan to kick out 0.8 which includes some bug fixes and any Rails 2.x issues as soon as possible.&lt;/p&gt;


	&lt;p&gt;I am also looking into using Lighthouse for tickets. Rubyforge&#8217;s bug tracking isn&#8217;t the greatest and apparently there have been tickets there for a while that I had no idea about (sorry about that).&lt;/p&gt;


	&lt;p&gt;0.9 will be the first release where I look to improve and cleanup the codebase.  Thanks for your patience.&lt;/p&gt;


	&lt;p&gt;Any questions, comments or suggestions feel free to let me know. Thanks,&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-06-03:538</id>
    <published>2008-06-03T23:43:00Z</published>
    <updated>2008-06-03T23:43:52Z</updated>
    <link href="http://continuousthinking.com/2008/6/3/refactoring-your-rails-application-tutorial-content" rel="alternate" type="text/html"/>
    <title>Refactoring Your Rails Application - Tutorial Content</title>
<content type="html">
            I posted the tutorial slides and example app as well as the refactoring catalog to OReilly&#8217;s RailsConf 2008 web site, but I couldn&#8217;t tell you where to access it, because I couldn&#8217;t find the public download links.  So here are the links to the material on this server:
	&lt;ul&gt;
	&lt;li&gt;&lt;a href='http://www.continuousthinking.com/railsconf2008/refactoring_your_rails_application_catalog.pdf'&gt;Rails Refactoring Catalog from the tutorial&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href='http://www.continuousthinking.com/railsconf2008/refactoring_your_rails_app_slides.pdf'&gt;Refactoring Your Rails App tutorial slides&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href='http://www.continuousthinking.com/railsconf2008/example_app.zip'&gt;Refactoring Your Rails App example app from the tutorial&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The example app is also available from github if you&#8217;d like to download the revisions and the different branches used for the tutorial&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href='http://github.com/zdennis/strac/'&gt;http://github.com/zdennis/strac/&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Just refer to the refactoring branch and any other branch with &#8220;refactoring&#8221; in the name.&lt;/p&gt;


	&lt;p&gt;The official project which the example app is based on is called Strac. The official github repository can be found at &lt;a href='http://github.com/mvanholstyn/strac/'&gt;http://github.com/mvanholstyn/strac/&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;If you have any questions, comments or feedback on any of the material or the example app feel free to email me at zach dot dennis at gmail dot com.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-05-29:536</id>
    <published>2008-05-29T18:40:00Z</published>
    <updated>2008-05-29T21:46:35Z</updated>
    <link href="http://continuousthinking.com/2008/5/29/railsconf-ryra-how-d-it-go" rel="alternate" type="text/html"/>
    <title>RailsConf: RYRA, how'd it go?</title>
<content type="html">
            &lt;p&gt;In regards to the tutorial on Refactoring Your Rails Application,  how you felt the talk went?&lt;/p&gt;


	&lt;p&gt;I&#8217;ll post more later with slides and links for the downloadable code.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-05-05:530</id>
    <published>2008-05-05T09:58:00Z</published>
    <updated>2008-05-05T13:59:20Z</updated>
    <link href="http://continuousthinking.com/2008/5/5/h-r-5353-i-called-have-you" rel="alternate" type="text/html"/>
    <title>H.R. 5353 - I called, have you?</title>
<content type="html">
            &lt;p&gt;I just got off the phone with my state representative Peter Hoekstra&#8217;s office to urge him to support the Internet Freedom Preservation Act os 2008&#8212;&lt;a href='http://www.opencongress.org/bill/110-h5353/show'&gt;H.R. 5353&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;For more information on the issue or to determine who to call and what to say, please see &lt;a href='http://www.savetheinternet.com'&gt;www.savetheinternet.com&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-05-03:529</id>
    <published>2008-05-03T12:50:00Z</published>
    <updated>2008-05-03T16:51:00Z</updated>
    <link href="http://continuousthinking.com/2008/5/3/book-review-ruby-on-rails-enterprise-application-development" rel="alternate" type="text/html"/>
    <title>Book Review - Ruby on Rails: Enterprise Application Development</title>
<content type="html">
            &lt;p&gt;I know Slashdot is a busy place, but come on, four months and a book review is still pending, and they don&#8217;t respond to any emails? Anyways here is my review of &#8220;Ruby on Rails: Enterprise Application Development&#8221;.&lt;/p&gt;


&lt;p&gt;Ruby on Rails &#8211; Enterprise Application Development by Elliot Smith and Rob Nichols targets a new niche in the Rails world of published books. Its goal is to connect all of the dots that make up typical Rails development for developers who have been through the tutorials, but wonder &#8216;what do I do next?&#8217;&lt;/p&gt;

    &lt;p&gt;The focus of this book is breadth and not depth. The authors do a good job of balancing the explanation of essential Rails concepts while letting the reader know when they are approaching a more advanced topic that won&#8217;t be covered in depth.&lt;/p&gt;

    &lt;p&gt;Throughout the book the authors follow a fictional, yet realistic scenario in which Rory the IT guy implements a simple web-based contacts management application. Each chapter builds on the previous walking the reader through the whole process of development to production deployment.&lt;/p&gt;

    &lt;p&gt;There is no Rails development until Chapter 4, pg 91. The emphasis of the first 90 pages is understanding what Rails is and why you would use it, as well as introducing the problem scenario that will be used throughout the book. This would be a bigger turn off then it was, but the authors made up for this a little walking the reader through installing everything required for Rails development on multiple operating systems.&lt;/p&gt;

    &lt;p&gt;Rather then focus on a single platform for development or production the authors use a mixed environment of Ubuntu Linux, &lt;span class='caps'&gt;&lt;span class='caps'&gt;OSX&lt;/span&gt;&lt;/span&gt; and Windows and a cross platform Eclipse &lt;span class='caps'&gt;&lt;span class='caps'&gt;IDE&lt;/span&gt;&lt;/span&gt;. They also take the time to walk the reader through installation and setup of each platform as it pertains to Rails development.&lt;/p&gt;

    &lt;p&gt;The majority of the development in this book sticks to the functionality included in Rails itself. When it comes to core components of Rails the authors do a great job of covering them: migrations, models, validations, associations, controllers, filters, views and view helpers.&lt;/p&gt;

    &lt;p&gt;Plugins are not covered except for acts_as_attachment, which is now deprecated in favor of attachment_fu.&lt;/p&gt;

    &lt;p&gt;The only issue I had with the book was with the sections on testing. The authors cover unit and functional testing with the built-in Rails testing framework. Unfortunately, the example tests are horrible and should not appear in production quality code. The sections on testing should only be used to understand how the built-in testing framework works in Rails and not as an example for writing tests. It is too bad that the authors didn&#8217;t cover integration testing either.&lt;/p&gt;

    &lt;p&gt;A good thing that did come out of the testing sections in this book is the encouragement for developers to write tests which expose bugs before fixing them. It&#8217;s the only way to ensure you really fixed it.&lt;/p&gt;

    &lt;p&gt;Rails 1.2.3 is used throughout the book so any changes, improvements or deprecations in Rails 2.0 aren&#8217;t covered. If the reader follows the book with Rails 1.2.3 they should have no issues walking through and developing the code themselves. If the reader follows the book with Rails 2.0 they should be aware of some of the changes, those can be found at &lt;a href='http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done'&gt;http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;The things that stuck out to me were:&lt;/p&gt;

    &lt;ul&gt;
    &lt;li&gt;view template file naming conventions&lt;/li&gt;
        &lt;li&gt;the verbosity of not having named routes&lt;/li&gt;
        &lt;li&gt;the lack of the db:rollback rake task&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;The authors take the time to walk the reader through setting up and using Subversion as an integral part of Rails software development. It also includes setting up and using Apache and Mongrel to serve Rails. As the book moves from development to production deployment the user is shown how to deploy automatically from Subversion to their production server using Capistrano.&lt;/p&gt;

    &lt;p&gt;There were a few minor typos and one redundant sentence on page 52. This is considerably lower then other technical books that I&#8217;ve read.&lt;/p&gt;

    &lt;p&gt;The only giant red sections marked in my copy are the ones on testing. Take those examples with a grain of salt.&lt;/p&gt;

    &lt;p&gt;Overall, the majority of the book is filled with good advice for novice Rails developers like, &#8220;do not wait until your application is built before you create and test the production environment&#8221; and &#8220;involve the end users throughout the process&#8221;.&lt;/p&gt;

    &lt;p&gt;If you are a novice Rails developer who understand bits and pieces of Rails this book does a good job of connecting the other dots because the authors take the time to go through the full process of development to production. On the other hand if you have a good grasp on the whole Rails development process you can skip this book.&lt;/p&gt;

    &lt;p&gt;A good chapter outline of this book can be found at &lt;span class='caps'&gt;PACKT&lt;/span&gt;&#8217;s &lt;a href='http://www.packtpub.com/Ruby-on-Rails-Enterprise-Application-Open-Source/book'&gt;web site&lt;/a&gt;&lt;/p&gt;.
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-05-03:528</id>
    <published>2008-05-03T00:44:00Z</published>
    <updated>2008-05-03T04:44:47Z</updated>
    <link href="http://continuousthinking.com/2008/5/3/net-neutrality-save-the-internet" rel="alternate" type="text/html"/>
    <title>Net Neutrality - Save The Internet</title>
<content type="html">
            &lt;p&gt;If you haven&#8217;t heard of &lt;a href='http://en.wikipedia.org/wiki/Network_neutrality'&gt;Net Neutrality&lt;/a&gt; before, wikipedia describes it as:&lt;/p&gt;


	&lt;p&gt;&#8221;... a principle that is applied to residential broadband networks, and potentially to all networks. A neutral broadband network is one that is free of restrictions on the kinds of equipment that may be attached, on the modes of communication allowed, which does not restrict content, sites or platforms, and where communication is not unreasonably degraded by other communication streams.&#8221;&lt;/p&gt;


	&lt;p&gt;Unfortunately there are corporations out there which want to control access, speeds and content available to those connecting to the Internet through their services. Below is an informative 10 minute video (I found it at  &lt;a href='http://www.matthewgood.org/2008/05/net-neutrality/'&gt;http://www.matthewgood.org/2008/05/net-neutrality/&lt;/a&gt;). If you have the time please hit play.&lt;/p&gt;


&lt;div&gt;
&amp;lt;object height='355' width='425'&gt;
&amp;lt;param name='movie' value='http://www.youtube.com/v/JP_3WnJ42kw&#38;hl=en' /&gt;
&amp;lt;param name='wmode' value='transparent' /&gt;
&amp;lt;embed src='http://www.youtube.com/v/JP_3WnJ42kw&#38;hl=en' type='application/x-shockwave-flash' height='355' wmode='transparent' width='425' /&gt;
&amp;lt;/object&gt;
&lt;/div&gt;

	&lt;p&gt;If this issue concerns checkout &lt;a href='http://www.savetheinternet.com'&gt;www.savetheinternet.com&lt;/a&gt; . I urge you to spread awareness of the issue and contact your congressman.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-04-02:518</id>
    <published>2008-04-02T17:28:00Z</published>
    <updated>2008-04-02T21:29:46Z</updated>
    <link href="http://continuousthinking.com/2008/4/2/form_test_helper-select_form-update" rel="alternate" type="text/html"/>
    <title>form_test_helper, select_form update</title>
<content type="html">
            &lt;p&gt;Revision 71 of form_test_helper includes a bug fix for the select_form method. Previously calling select_form with a block would submit the form. The fix forces you to call submit on the form. So&#8230;&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;&lt;span class='c'&gt;# THIS which used to submit the form&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;form = select_form &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;trip&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class='r'&gt;do&lt;/span&gt; |form|&lt;tt&gt;
&lt;/tt&gt;  form.trip.destination = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;bahamas&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='c'&gt;# WILL NOW LOOK LIKE THIS&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;form = select_form &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;trip&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class='r'&gt;do&lt;/span&gt; |form|&lt;tt&gt;
&lt;/tt&gt;  form.trip.destination = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;bahamas&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;form.submit&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;This doesn&#8217;t affect the usage of submit_form which still acts as expected.&lt;/p&gt;


	&lt;p&gt;This will be included in the next release of form_test_helper. Currently trunk for form_test_helper works with Rails 2.0.0 and higher (including today&#8217;s most recent trunk commit).&lt;/p&gt;


	&lt;p&gt;The form_test_helper edge docs have been updated as well and can be found &lt;a href='http://continuous.rubyforge.org/form_test_helper/rdoc/'&gt;here&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-04-01:517</id>
    <published>2008-04-01T00:46:00Z</published>
    <updated>2008-04-01T00:46:36Z</updated>
    <link href="http://continuousthinking.com/2008/4/1/rails-ticket-11491" rel="alternate" type="text/html"/>
    <title>Rails Ticket #11491</title>
<content type="html">
            &lt;p&gt;If you have a few minutes, please review and comment on Rails ticket #11491.&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;&lt;a href='http://dev.rubyonrails.org/ticket/11491'&gt;http://dev.rubyonrails.org/ticket/11491&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;In short, it adds the ability for &#8220;render :partial =&amp;gt; some_collection&#8221; to render the correct partial based on each element in some_collection. Currently Rails uses the first element to determine what to render for every element in the collection.&lt;/p&gt;


	&lt;p&gt;Thanks in advance,&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-03-25:510</id>
    <published>2008-03-25T03:38:00Z</published>
    <updated>2008-03-25T03:41:05Z</updated>
    <link href="http://continuousthinking.com/2008/3/25/more-people-more-progress" rel="alternate" type="text/html"/>
    <title>More People != More Progress</title>
<content type="html">
            &lt;p&gt;There is a common misconception that the best way to add capacity to a project and reduce its completion date is simple&#8212;just throw more people at it. Although there is some truth in this, it is usually applied at the wrong times and it ends up having a very negative impact on the project.&lt;/p&gt;


	&lt;p&gt;This mindset that project development is a series of tasks and that somehow you can just throw people at them and everything will work out is foreign to me, because it won&#8217;t work out&#8212;at least not when it&#8217;s applied in haste.&lt;/p&gt;


	&lt;p&gt;Adding value to a project is more than completing tasks. Tasks are not isolated during project development. They are features which build on top of one another. Making good responsible decisions and understanding the code base both technically and conceptually goes a long way to help exploit easier and better ways of implementing features. This also helps keep the code base well factored, which in turn helps teams progress consistently and avoid creating a giant roadblock of technical debt which may have lurked just ahead.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://continuousthinking.com/">
    <author>
      <name>zdennis</name>
    </author>
    <id>tag:continuousthinking.com,2008-03-22:505</id>
    <published>2008-03-22T00:58:00Z</published>
    <updated>2008-03-22T05:01:41Z</updated>
    <category term="factory_loader"/>
    <link href="http://continuousthinking.com/2008/3/22/why_factory_loader" rel="alternate" type="text/html"/>
    <title>What is a factory and why FactoryLoader?</title>
<content type="html">
            &lt;p&gt;This statement and question were posted to the &lt;a href='http://www.gr-ruby.org'&gt;http://www.gr-ruby.org&lt;/a&gt; mailing list as it pertained to the release of FactoryLoader. This post should answer the question &#8220;what is a factory?&#8221; and also provide more insight into what FactoryLoader&#8217;s role is.&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;&amp;gt; I've read over your website, but I still have a lagging question which&lt;tt&gt;
&lt;/tt&gt;&amp;gt; completely blinds my ability to see the usefulness of it: What is a factory?&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;A factory is &#8220;a mechanism for encapsulating complex creation logic&#8221; [0].&lt;/p&gt;


	&lt;p&gt;Here&#8217;s an example. Let&#8217;s say that you start writing an application that is a project management tool for a business. To start with they need the ability to create Projects. This is no big deal, you have a ProjectsController#create action and it makes your Project by doing something similar to the below:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;  &lt;span class='r'&gt;def&lt;/span&gt; &lt;span class='fu'&gt;create&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    project = &lt;span class='co'&gt;Project&lt;/span&gt;.new params[&lt;span class='sy'&gt;:project&lt;/span&gt;]&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;if&lt;/span&gt; project.save&lt;tt&gt;
&lt;/tt&gt;      flash[&lt;span class='sy'&gt;:notice&lt;/span&gt;] = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;successfully created the project&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      render &lt;span class='sy'&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;create&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;else&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      flash[&lt;span class='sy'&gt;:error&lt;/span&gt;] = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;failed to create the project&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      render &lt;span class='sy'&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;new&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;  &lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;Now a few weeks later the customer says that in order to create a project it needs to be assigned a project manager off the bat (the currently logged in user). This is not a very big deal since you have a &#8220;current_user&#8221; already, you just update your controller to look like:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;  &lt;span class='r'&gt;def&lt;/span&gt; &lt;span class='fu'&gt;create&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    project = &lt;span class='co'&gt;Project&lt;/span&gt;.new params[&lt;span class='sy'&gt;:project&lt;/span&gt;]&lt;tt&gt;
&lt;/tt&gt;    project.manager = current_user&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;if&lt;/span&gt; project.save&lt;tt&gt;
&lt;/tt&gt;      flash[&lt;span class='sy'&gt;:notice&lt;/span&gt;] = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;successfully created the project&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      render &lt;span class='sy'&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;create&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;else&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      flash[&lt;span class='sy'&gt;:error&lt;/span&gt;] = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;failed to create the project&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      render &lt;span class='sy'&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;new&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;A few more weeks go by and your customer says that projects are tied to company budgets and when they are created they need to be automatically assigned to the correct budget based on the type of project. So we update to ProjectsController#create looks like the below:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;  &lt;span class='r'&gt;def&lt;/span&gt; &lt;span class='fu'&gt;create&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    project = &lt;span class='co'&gt;Project&lt;/span&gt;.new params[&lt;span class='sy'&gt;:project&lt;/span&gt;]&lt;tt&gt;
&lt;/tt&gt;    project.manager = current_user&lt;tt&gt;
&lt;/tt&gt;    project.budget = &lt;span class='co'&gt;Budget&lt;/span&gt;.find_by_project_type(project.type)&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;if&lt;/span&gt; project.save&lt;tt&gt;
&lt;/tt&gt;      flash[&lt;span class='sy'&gt;:notice&lt;/span&gt;] = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;successfully created the project&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;else&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      flash[&lt;span class='sy'&gt;:error&lt;/span&gt;] = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;failed to create the project&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      render &lt;span class='sy'&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;new&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;  &lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;Uh oh. There are important business rules being applied in the controller. The controller&#8217;s responsibility is to map an incoming request with an outgoing response and to know high level what the application needs to be doing. It should not know the intimate details of Project creation. Since we&#8217;re implementing the business rules on the controller we can&#8217;t re-use them for anything, unless we make a &lt;span class='caps'&gt;POST&lt;/span&gt; request to ProjectsController#create. This is quite limiting.&lt;/p&gt;


	&lt;p&gt;Another option to make them more reusable would be to tuck this away in the Project model itself. Perhaps we add a before_save callback which finds the appropriate budget. Even then we&#8217;ve only moved the budget logic out of the controller and there is still requirement for a Project to have a manager. If we go this route we&#8217;ll be separating two important pieces of how a Project gets constructed from each other. We would have the ProjectsController#create action setting the manager and then a before_save callback on the Project model finding a budget, both of which are required for a Project to be constructed.&lt;/p&gt;


	&lt;p&gt;One thought to remedy this would be put everything in the Project model, maybe in a before_save callback or overriding the constructor. But we quickly hit a roadblock because our Project model doesn&#8217;t know about the current user, that is application state and only the model knows about that. We could do something stupid and make the current_user global to the application, but that is a bad decision with pretty bad repercussions.&lt;/p&gt;


	&lt;p&gt;It&#8217;d be nice if we had a single object responsible for constructing a Project with these business rules. This is where a ProjectFactory comes into play. The ProjectFactory looks like:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;  &lt;span class='r'&gt;class&lt;/span&gt; &lt;span class='cl'&gt;ProjectFactory&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;def&lt;/span&gt; &lt;span class='fu'&gt;create&lt;/span&gt;(project_attrs, manager)&lt;tt&gt;
&lt;/tt&gt;      project = &lt;span class='co'&gt;Project&lt;/span&gt;.new project_attrs&lt;tt&gt;
&lt;/tt&gt;      project.budget = &lt;span class='co'&gt;Budget&lt;/span&gt;.find_by_project_type(project.type)&lt;tt&gt;
&lt;/tt&gt;      project.save!&lt;tt&gt;
&lt;/tt&gt;      project&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;And the ProjectsController#create action looks like:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;  &lt;span class='r'&gt;def&lt;/span&gt; &lt;span class='fu'&gt;create&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    project = &lt;span class='co'&gt;ProjectFactory&lt;/span&gt;.create params[&lt;span class='sy'&gt;:project&lt;/span&gt;], current_user&lt;tt&gt;
&lt;/tt&gt;    flash[&lt;span class='sy'&gt;:notice&lt;/span&gt;] = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;successfully created the project&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;rescue&lt;/span&gt; &lt;tt&gt;
&lt;/tt&gt;    flash[&lt;span class='sy'&gt;:error&lt;/span&gt;] = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;failed to create the project&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    render &lt;span class='sy'&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;new&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;    &lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;This is pretty straightforward. I just moved some of the lines from the action into the factory. More importantly then just moving line of code is that the act of constructing a valid project (given the customer&#8217;s requirements) isn&#8217;t the responsibility of the Project. The act of constructing a valid project is a process by itself which is important to the customer, so we isolate it in a ProjectFactory.&lt;/p&gt;


	&lt;p&gt;This is valuable because:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;the business logic used to construct a project is in one spot. Should the customer change, add or remove requirements you only have to go to one spot to implement them. Granted if the method signature to this changes you have to go update the spots calling the create method, but you the actual logic for constructing the project isn&#8217;t spread throughout multiple files or classes.&lt;/li&gt;
		&lt;li&gt;it promotes reusability (the whole &lt;span class='caps'&gt;DRY&lt;/span&gt; thing), since my ProjectFactory is much more reusable then my ProjectsController.&lt;/li&gt;
		&lt;li&gt;it promotes single responsibility&lt;/li&gt;
		&lt;li&gt;it provides clearer meaning to the code base because we aren&#8217;t muddying up the controller or the Project model with creation logic&lt;/li&gt;
		&lt;li&gt;it makes for easier testing and easier to understand tests&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The technical implementation of this pattern is mentioned in the GoF book [1]. The value of the pattern as it applies to Domain Driven Design is mentioned in the &lt;span class='caps'&gt;DDD&lt;/span&gt; book by Eric Evans.&lt;/p&gt;


	&lt;p&gt;Hopefully that helps clarify what a factory is, by seeing how it is used and some of the value it provides. This relates to the FactoryLoader because sometimes the progression of creation logic is over time.&lt;/p&gt;


	&lt;p&gt;For the first few weeks or months of a project you are hardcoding things like &#8220;Project.create&#8221; in multiple spots. When the customer starts introducing requirements for constructing (or updating) a Project you have to go update all of those spots with the same code (violating &lt;span class='caps'&gt;DRY&lt;/span&gt;) or go find all of those spots and refactor them to use a ProjectFactory, and then make a ProjectFactory. It doesn&#8217;t happen all the time, but when it does happen it can be time consuming, frustrating and painful to do.&lt;/p&gt;


	&lt;p&gt;What FactoryLoader would do in our example is it give us a ProjectFactory upfront w/o having to write any code. If we used FactoryLoader in the above example our ProjectsController#create action would look like:&lt;/p&gt;


&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;  &lt;span class='r'&gt;def&lt;/span&gt; &lt;span class='fu'&gt;create&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    project = &lt;span class='co'&gt;ProjectFactory&lt;/span&gt;.create params[&lt;span class='sy'&gt;:project&lt;/span&gt;]&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;if&lt;/span&gt; project.save&lt;tt&gt;
&lt;/tt&gt;      flash[&lt;span class='sy'&gt;:notice&lt;/span&gt;] = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;successfully created the project&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      render &lt;span class='sy'&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;create&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;else&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      flash[&lt;span class='sy'&gt;:error&lt;/span&gt;] = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;failed to create the project&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      render &lt;span class='sy'&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;new&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;  &lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;Where the ProjectFactory is created for you by FactoryLoader (you didn&#8217;t create the class, FactoryLoader did dynamically). There&#8217;s only one line that differs between the example that uses the FactoryLoader and the one that doesn&#8217;t.&lt;/p&gt;


	&lt;p&gt;Now when the customer starts adding business rules for creating a Project you can create your own ProjectFactory class and implement the customer&#8217;s business rules.   FactoryLoader will see that you have provided your own ProjectFactory so it won&#8217;t dynamically create one. Since all of the spots where you create a Project are already using a ProjectFactory they get the changes for free. Overall you get to touch less code for the changes and you get to spend less time refactoring if any refactoring is needed.&lt;/p&gt;


	&lt;p&gt;The goal of FactoryLoader is to allow developers the ability to scale to these customer requirements with less pain. The above examples have been quite trivial, hopefully they are clear enough and meaningful enough to express why I wrote FactoryLoader,&lt;/p&gt;


	&lt;p&gt;&#8212;
Zach Dennis
http://www.continuousthinking.com&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;0 &#8211; Domain Driven Design by Eric Evans&lt;/li&gt;
		&lt;li&gt;1 &#8211; Design Patterns: Elements of Reusable Object-Oriented Software by Gamma, Helm, Johnson and Vlissides&lt;/li&gt;
	&lt;/ul&gt;
          </content>  </entry>
</feed>
