<?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>Following the rewrite</title>
    <link>http://rewrite.rickbradley.com/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>A journey on Rails</description>
    <item>
      <title>COSMOS documentation</title>
      <description>&lt;p&gt;For those of you who are fans of Martin Fowler&amp;#8217;s &lt;a href="http://www.martinfowler.com/books.html#ap"&gt;&lt;em&gt;Analysis Patterns&lt;/em&gt;&lt;/a&gt; tome of wisdom, and who are curious about the &lt;span class="caps"&gt;COSMOS&lt;/span&gt; clinical process model project that inspired much of that book, you may be interested in reading the documents linked below.&lt;/p&gt;


	&lt;p&gt;When Charles and I went to RailsConf this year to speak about the success we&amp;#8217;ve been having building a comprehensive research-friendly health record, we were approached by Adam Cavan from the audience who was interested in our project.  He asked how much of the &lt;span class="caps"&gt;COSMOS&lt;/span&gt; documentation we&amp;#8217;d read before embarking upon our project.  We were sad to say that we&amp;#8217;d never been able to actually acquire a copy of the documents, as no one seemed to have kept them around, nor were they to be found online any more.&lt;/p&gt;


	&lt;p&gt;&amp;#8220;Oh,&amp;#8221; said Adam, &amp;#8220;I&amp;#8217;ve got a copy&amp;#8212;would you like to see them?&amp;#8221;  Would we ever.  And he was as good as his word.  Thanks to his kindness we&amp;#8217;re also making those documents, with all their amazing insights, available here. By the way, you can reach Adam here: acavan (at) suika (dot) com.&lt;/p&gt;


	&lt;p&gt;Note we don&amp;#8217;t pretend to own these documents, but given that they were at one time available on the web we hope our posting will be looked upon kindly as a service to the software and medical care communities.&lt;/p&gt;


	&lt;p&gt;Without further verbage, here are .doc and .pdf versions of the documents we received:&lt;/p&gt;


&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;&lt;span class="caps"&gt;DOC&lt;/span&gt;&lt;/th&gt;&lt;th&gt;&lt;span class="caps"&gt;PDF&lt;/span&gt;&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt1_clean.doc"&gt;The Clinical View of the Common Basic Specification&lt;/a&gt; (CCPM2 Part 1 &amp;#8211; &amp;#8220;Clean&amp;#8221;)&lt;/td&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt1_clean.pdf"&gt;The Clinical View of the Common Basic Specification&lt;/a&gt; (CCPM2 Part 1 &amp;#8211; &amp;#8220;Clean&amp;#8221;)&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt1.doc"&gt;The Clinical View of the Common Basic Specification&lt;/a&gt; (CCPM2 Part 1)&lt;/td&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt1.pdf"&gt;The Clinical View of the Common Basic Specification&lt;/a&gt; (CCPM2 Part 1)&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt2_clean.doc"&gt;The Activity Diagram&lt;/a&gt; (CCPM2 Part 2 &amp;#8211; &amp;#8220;Clean&amp;#8221;)&lt;/td&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt2_clean.pdf"&gt;The Activity Diagram&lt;/a&gt; (CCPM2 Part 2 &amp;#8211; &amp;#8220;Clean&amp;#8221;)&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt2_clean.doc"&gt;The Activity Diagram&lt;/a&gt; (CCPM2 Part 2)&lt;/td&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt2_clean.pdf"&gt;The Activity Diagram&lt;/a&gt; (CCPM2 Part 2)&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt3_clean.doc"&gt;Glossary of Concept Names&lt;/a&gt; (CCPM2 Part 3 &amp;#8211; &amp;#8220;Clean&amp;#8221;)&lt;/td&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt3_clean.pdf"&gt;Glossary of Concept Names&lt;/a&gt; (CCPM2 Part 3 &amp;#8211; &amp;#8220;Clean&amp;#8221;)&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt3_clean.doc"&gt;Glossary of Concept Names&lt;/a&gt; (CCPM2 Part 3)&lt;/td&gt;
    &lt;td&gt;&lt;a href="/files/ccpm2pt3_clean.pdf"&gt;Glossary of Concept Names&lt;/a&gt; (CCPM2 Part 3)&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

	&lt;p&gt;&lt;em&gt;&lt;span class="caps"&gt;UPDATE&lt;/span&gt;&lt;/em&gt;:  Added better versions of the &amp;#8220;clean&amp;#8221; PDFs&amp;#8212;also added attribution to our previously pseudo-anonymous friend who found these documents.  Tahnks Adam!&lt;/p&gt;</description>
      <pubDate>Thu, 06 Jul 2006 13:43:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:57e23ca6-9ad6-4b8c-8ea8-737700c08298</guid>
      <author>rick</author>
      <link>http://rewrite.rickbradley.com/articles/2006/07/06/cosmos-documentation</link>
      <category>cosmos</category>
    </item>
    <item>
      <title>Rails on freeBSD</title>
      <description>&lt;p&gt;The rewrite project has us needing to support three different databases: Oracle, postgresql and SQLServer. Rather than take the approach of using MySQL as seen in &amp;#8220;Agile Web Development with Rails&amp;#8221; I decided to setup rails to use postgreSQL on my freebsd desktop and laptop. Installing this &lt;span class="caps"&gt;FLPR&lt;/span&gt; environment (freebsd, lighttpd, postgreSQL and rails) turned out to be straightforward despite some sketchy documentation. Those of you using freebsd may want to give this a try. As always it is important to become root to update the ports collection, then checking to see if any currently installed ports need to be upgraded before beginning.&lt;/p&gt;


	&lt;p&gt;Having done that, then as root cd to&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;/usr/ports/databases/postgresql81-server/&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;and do &lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;make all &amp;#38;&amp;#38; make install &amp;#38;&amp;#38; make clean&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;This will install both the postgres server and client ports, and it will also have created a pgsql user along with a /usr/local/pgsql directory. This user will own all the data files and must also own the server process. Now the databse files and inital tablespaces need to be created. So, su to the pgsql user and then do&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;/usr/local/bin/initdb&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;If you want postgreSQL to start at boot, then make sure that postgresql_enable=&amp;#8221;YES&amp;#8221; appears in /etc/rc.conf. Don&amp;#8217;t start an instance of the databse just yet, but rather exit back to being root and install the rails port. Just cd to /usr/ports/www/rubygem-rails and do the usual&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;make all &amp;#38;&amp;#38; make install &amp;#38;&amp;#38; make clean&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Then cd to /usr/ports/www/rubygem-redcloth and do the same make sequence.&lt;/p&gt;


	&lt;p&gt;Next the C source code adapter needs to be installed. Unfortunately, neither the rails install nor the postgreSQL install will correctly set the lib path for building the adapter, so you need to set an environment variable otherwise the build will fail. So, as root do&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;setenv POSTGRES_INCLUDE /usr/local/include/&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;follwed by&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;gem install postgres&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Now, a database instance can be started, so, su to the pgsql user and do&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;/usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;You will need to create yourself as a database user (actually, as a superuser). Here is how I did myself&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;/usr/local/bin/createuser charles&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) y
CREATE USER&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;If you feel more comfortable with a gui-interface for database administration, consider installing the pgadmin3 port.&lt;/p&gt;


	&lt;p&gt;Lastly, when you create your rails app, you will need to modify the config/database.yml file by commenting out all the lines except the postgreSQL entries and then modify those using the names of the three databases you need (ehr_* in my case):&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;development:
 adapter: postgresql
 database: ehr_development
 username: charles
 password:
 host: 127.0.0.1
 port: 5432&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;test:
 adapter: postgresql
 database: ehr_test
 username: charles
 password: 
 host: 127.0.0.1
 port: 5432&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;production:
 adapter: postgresql
 database: ehr_production
 username: charles
 password: 
 host: 127.0.0.1
 port: 5432&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Using postgreSQL in a tiered environment is only slightly more complicated, and I&amp;#8217;ll do a post about that sometime in the future.&lt;/p&gt;</description>
      <pubDate>Sun, 26 Feb 2006 17:08:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:87c7d2b7-ffb7-4a7f-b17e-ed1dca0ee92c</guid>
      <author>charles</author>
      <link>http://rewrite.rickbradley.com/articles/2006/02/26/rails-on-freebsd</link>
      <category>ruby on rails</category>
      <category>freebsd</category>
      <category>postgresql</category>
      <category>charles</category>
      <category>rails</category>
      <category>lighttpd</category>
    </item>
    <item>
      <title>svnbot</title>
      <description>&lt;p&gt;I&amp;#8217;ve only been here a few days, so I&amp;#8217;m still trying to come up to speed on how everything is working.  They&amp;#8217;re using &lt;a href="http://wiki.rubyonrails.org/rails/pages/How+To+Use+CIA+For+Continuous+Integration"&gt;&lt;span class="caps"&gt;CIA&lt;/span&gt;&lt;/a&gt; to do their continuous integrations after each svn commit.  They then have a bot on our local irc server that announces whether the build is broken after the recent commit.  While it&amp;#8217;s nice to know whether the build is broken or not, I wanted to know the commit message and what files were touched.  Enter &lt;a href="http://kevin.sb.org"&gt;Kevin Ballard&amp;#8217;s&lt;/a&gt; &lt;a href="http://kevin.sb.org/files/svnbot.zip"&gt;svnbot&lt;/a&gt;.  They used to use this in &lt;a href="irc://irc.freenode.net/typo"&gt;typo&lt;/a&gt; but they&amp;#8217;ve apparently stopped in the last few months.  The major bonus here is not having to go to our local trac server to see what files were modified and what the other developer had to say about the code they just committed.&lt;/p&gt;</description>
      <pubDate>Fri, 24 Feb 2006 14:25:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:937e3907-736f-4e0d-9e4f-a8e3d4e9f004</guid>
      <author>corey</author>
      <link>http://rewrite.rickbradley.com/articles/2006/02/24/svnbot</link>
      <category>subversion</category>
      <category>rbot</category>
      <category>svnbot</category>
      <category>integration</category>
      <category>svn</category>
    </item>
    <item>
      <title>Excellent screencast for &amp;quot;Selenium on Rails&amp;quot;</title>
      <description>&lt;p&gt;Check this out.  Jonas Bengtsson has released a &lt;a href="http://andthennothing.net/archives/2006/02/20/show-dont-tell"&gt;new screencast&lt;/a&gt; showing how to integrate Ruby and Selenium for browser-based acceptance testing.  Bonuses include use of the Selenium &lt;span class="caps"&gt;IDE&lt;/span&gt;, Ruby test authoring, and automation of both IE and Firefox (on Windows, granted, but it&amp;#8217;ll be cross-platform shortly, I have a feeling).&lt;/p&gt;


	&lt;p&gt;Very cool.&lt;/p&gt;</description>
      <pubDate>Mon, 20 Feb 2006 14:46:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:0fb5cc20-3920-4bb7-b100-37a79b73f167</guid>
      <author>rick</author>
      <link>http://rewrite.rickbradley.com/articles/2006/02/20/excellent-screencast-for-selenium-on-rails</link>
      <category>ruby on rails</category>
      <category>testing</category>
      <category>automation</category>
      <category>ruby</category>
      <category>rails</category>
      <category>selenium</category>
      <category>testing</category>
      <category>rick</category>
      <category>ie</category>
    </item>
    <item>
      <title>Building IE on Linux</title>
      <description>&lt;p&gt;There&amp;#8217;s been some interest from people who want to set up &amp;#8220;IE on Linux&amp;#8221; as we mentioned we were doing to help with automating IE testing.  As you&amp;#8217;ll see, the process is merely a testament to the hard work done by others to make this not only possible but easy.&lt;/p&gt;


	&lt;p&gt;First off, make sure you&amp;#8217;ve got licenses for the software you&amp;#8217;re installing.  I&amp;#8217;m not pretending to be a lawyer, not pretending to interpret the Microsoft &lt;span class="caps"&gt;EUL&lt;/span&gt;As that might apply.  I think it&amp;#8217;s safe to say you&amp;#8217;d better have licenses on hand.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ll be assuming you don&amp;#8217;t already have Wine installed and that you don&amp;#8217;t already have a ~/.wine directory already.  If you do you&amp;#8217;ll need to take that into account.  I&amp;#8217;m installing on Debian (unstable), but I&amp;#8217;ll be installing from tarballs, so as long as you&amp;#8217;ve got the dependencies needed to compile wine you should be ok.&lt;/p&gt;


	&lt;p&gt;Ok, it&amp;#8217;s just this simple:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;download the 0.9.7 &lt;a href="http://sourceforge.net/project/showfiles.php?group_id=6241&amp;#38;package_id=77449"&gt;Wine&lt;/a&gt;
 tarball &lt;a href="http://internap.dl.sourceforge.net/sourceforge/wine/wine-0.9.7.tar.bz2"&gt;here&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;tar xvj wine-0.9.7.tar.bz2&lt;/li&gt;
		&lt;li&gt;cd wine-0.9.7&lt;/li&gt;
		&lt;li&gt;./tools/wineinstall&lt;/li&gt;
		&lt;li&gt;cd ..&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;download &lt;a href="http://www.von-thadden.de/Joachim/WineTools/"&gt;winetools&lt;/a&gt; tarball from &lt;a href="http://ds80-237-203-29.dedicated.hosteurope.de/wt/winetools-0.9jo-III.tar.gz"&gt;here&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;tar xvfz winetools-0.9jo-III.tar.gz&lt;/li&gt;
		&lt;li&gt;cd winetools-0.9jo-III&lt;/li&gt;
		&lt;li&gt;su&lt;/li&gt;
		&lt;li&gt;./install&lt;/li&gt;
		&lt;li&gt;exit&lt;/li&gt;
		&lt;li&gt;cd ..&lt;/li&gt;
		&lt;li&gt;wt
	&lt;ul&gt;
	&lt;li&gt;do Base Config &lt;/li&gt;
		&lt;li&gt;create a Fake Windows Drive&lt;/li&gt;
		&lt;li&gt;Install TrueTypeFont Arial&lt;/li&gt;
		&lt;li&gt;Install &lt;span class="caps"&gt;DCOM 98&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;Install Microsoft Foundation Classes 4.x&lt;/li&gt;
		&lt;li&gt;Install Internet Explorer &lt;span class="caps"&gt;SP1 &lt;/span&gt;English&lt;/li&gt;
	&lt;/ul&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Now, if like us you are behind a proxying firewall, you&amp;#8217;ll have a headache when trying to install IE since the installer doesn&amp;#8217;t typically see your proxy.  To install from behind the proxy you&amp;#8217;ll need to do the following:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Wait for the download to eventually time out and fail.&lt;/li&gt;
		&lt;li&gt;Click &amp;#8220;Advanced&amp;#8221; &lt;/li&gt;
		&lt;li&gt;Click the proxy checkbox, then fill in our proxy IP and port.
	&lt;ul&gt;
	&lt;li&gt;(For some reason I had problems typing in the proxy info boxes and had to use cut-and-paste to get the info in there(?!).&lt;/li&gt;
	&lt;/ul&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;When you&amp;#8217;re done, exit out of Winetools.  Now you&amp;#8217;ve got a .wine/ directory with a &amp;#8220;C drive&amp;#8221; with &lt;span class="caps"&gt;IE6&lt;/span&gt; installed.  I&amp;#8217;d advise backing up .wine/ so you can recreate this configuration with a one-liner (now, don&amp;#8217;t you wish that working with Windows was always this easy?  Heh.)&lt;/p&gt;


	&lt;p&gt;To run IE now, simply run IE:&lt;/p&gt;


	&lt;p&gt;% wine &amp;#8221;$HOME/.wine/c/Program Files/Internet Explorer/IEXPLORE.EXE&amp;#8221;&lt;/p&gt;


	&lt;p&gt;You can append arguments for IE to the end of the command-line.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve verified that Javascript does indeed work, but &lt;span class="caps"&gt;PNG&lt;/span&gt; support is still missing.  I haven&amp;#8217;t had a chance to try the things mentioned in &lt;a href="http://forums.gentoo.org/viewtopic.php?p=1468418"&gt;this forum&lt;/a&gt; yet to see if I can get PNGs working.  Any feedback on that issue is welcome.&lt;/p&gt;</description>
      <pubDate>Sat, 18 Feb 2006 12:46:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:17ba8ace-a1e6-45d3-8eee-eee12af7e6e7</guid>
      <author>rick</author>
      <link>http://rewrite.rickbradley.com/articles/2006/02/18/building-ie-on-linux</link>
      <category>testing</category>
      <category>ie</category>
      <category>linux</category>
    </item>
    <item>
      <title>[PATCH] RJS templates cause render :action =&amp;gt; :symbol to fail</title>
      <description>&lt;p&gt;We ran into a problem once we installed the &lt;span class="caps"&gt;RJS&lt;/span&gt; templates plugin.  Turns out the problem isn&amp;#8217;t just in the plugin, but also in edge rails.  We wrote up a quick patch that fixed the problem and then wanted to pass the info upstream.&lt;/p&gt;


	&lt;p&gt;After talking briefly with the maintainer of the &lt;span class="caps"&gt;RJS&lt;/span&gt; templates plugin (&lt;a href="http://www.codyfauser.com/"&gt;Cody Fauser&lt;/a&gt;) we were pointed to the proper Rails file to put our test in.  So we wrote up a quick actionpack unit test for the problem and tried it out.  Yep, there it was.&lt;/p&gt;


	&lt;p&gt;So we filed a ticket with a patch &amp;#38; unit test:  &lt;a href="http://dev.rubyonrails.org/ticket/3861"&gt;#3861&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Thu, 16 Feb 2006 15:22:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:830ca959-55d2-477d-ae1f-c28f9ec091b9</guid>
      <author>rick</author>
      <link>http://rewrite.rickbradley.com/articles/2006/02/16/patch-rjs-templates-cause-render-action-symbol-to-fail</link>
      <category>ruby on rails</category>
      <category>rjs</category>
      <category>rick</category>
      <category>patch</category>
      <category>3861</category>
      <category>templates</category>
    </item>
    <item>
      <title>IE on Linux</title>
      <description>&lt;p&gt;
Taking the advice of Peter Merel from the last post, we're beginning to pursue the automation of browser-based testing for the project.  Automation to me means Linux (no way in hell I'm going to try this on Windows, that's just a rabbit hole), so I set up Microsoft Internet Explorer 6 on Linux this afternoon.  I'm not sure if this is sacrilege or making the best of a bad lot.
&lt;/p&gt;
&lt;p&gt;
Either way, here's proof:
&lt;/p&gt;
&lt;div&gt;
&lt;a href="http://rewrite.rickbradley.com/files/ie6_on_linux.png"&gt;&lt;img src="/files/ie6_on_linux-640.png"&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <pubDate>Tue, 14 Feb 2006 16:22:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:80e7b37e-72aa-454f-85c4-569332090de0</guid>
      <author>rick</author>
      <link>http://rewrite.rickbradley.com/articles/2006/02/14/ie-on-linux</link>
      <category>testing</category>
      <category>ie</category>
      <category>linux</category>
    </item>
    <item>
      <title>Help testing helpers</title>
      <description>&lt;p&gt;Ruby on Rails is big on testing.  There&amp;#8217;s support for unit testing cooked right in&amp;#8212;every time you create a model you get the unit testing framework built for free&amp;#8212;just fill in the blanks.  Similarly, whenever you create a new controller, you get the functional testing framework built for free&amp;#8212;just fill in the blanks.  Seems like view testing (with Selenium and OpenQA) is moving forward, and I wonder if some sort of automated support for those won&amp;#8217;t come from the Rails framework itself soon&amp;#8230;&lt;/p&gt;


	&lt;p&gt;That said, there&amp;#8217;s very little talk about testing helpers&amp;#8212;those bits of Ruby code that are made available for use by the view, but which aren&amp;#8217;t in the templates themselves.  Helpers aid reuse, and are a valuable use of Ruby behind the template.&lt;/p&gt;


	&lt;p&gt;Certain helpers can be tested with test/unit, just like unit tests for models.  Some helpers, though, call functionality in the view libraries:  a really common idiom is to provide various foo_link() methods that will generate links to certain types of objects.  Rather than repeating the same detailed ActionView link_to() call everywhere, the code is factored out to a helper method which assembles the appropriate information and calls link_to() for you.  Then you&amp;#8217;ve got a single point of change whenever you want to change how comment links, story links, user links, whatever, behave.&lt;/p&gt;


	&lt;p&gt;Testing this sort of code should require a functional test, since you&amp;#8217;ll actually want to have the view instantiated.  There&amp;#8217;s seemingly zero documentation on how to do this, and, checking around on some existing Ruby projects, I see people writing these sorts of helpers, but I see noone actually testing them.&lt;/p&gt;


	&lt;p&gt;We&amp;#8217;ve jumped back for a moment and are relying on &amp;#8220;stub&amp;#8221; code to allow us to get a primitive, but less than ideal, test of our link helper (and other similar helpers that call ActionView functionality).  We&amp;#8217;re now looking for guidance from the Rails community.&lt;/p&gt;


	&lt;p&gt;To that end, we&amp;#8217;ve posted &lt;a href="http://dev.rubyonrails.org/ticket/3775"&gt;Rails ticket #3775&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Wed, 08 Feb 2006 15:31:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:4fc8c288-81f8-45ff-b765-fa96679a852c</guid>
      <author>rick</author>
      <link>http://rewrite.rickbradley.com/articles/2006/02/08/help-testing-helpers</link>
      <category>ruby on rails</category>
      <category>testing</category>
      <category>ruby</category>
      <category>rails</category>
      <category>testing</category>
      <category>rick</category>
      <category>helpers</category>
      <category>bug</category>
      <category>ticket</category>
    </item>
    <item>
      <title>RJS Templates</title>
      <description>We had a brief introduction session about RJS templates (a way to automate AJAX actions for Rails) recently.  The HOWTO document appears below.

We've also provided an mp3 download of the &lt;a href="/files/presentation_rjs_templates-20060131.mp3"&gt;audio from the presentation&lt;/a&gt; we had for the team.&lt;h3&gt;About&lt;/h3&gt;

    &lt;p class="h3"&gt;RJS Templates are similar to .rhtml templates except they contain Javascript commands and have an .rjs file extension.  The action/view base naming scheme remains the same.  Unlike conventional templates which are used to render the results of an action, these templates generate instructions on how to modify an already rendered page. This makes it easy to modify multiple elements on your page in one declarative Ajax response. Actions with these templates are called in the background with Ajax and make updates to the page where the request originated from.&lt;/p&gt;

    &lt;p class="h3"&gt;Currently supported RJS methods/features:
    &lt;ul&gt;
    &lt;li&gt;insert_html&lt;/li&gt;
    &lt;li&gt;replace_html&lt;/li&gt;
    &lt;li&gt;show&lt;/li&gt;
    &lt;li&gt;hide&lt;/li&gt;

    &lt;li&gt;visual_effect&lt;/li&gt;
    &lt;li&gt;alert&lt;/li&gt;
    &lt;li&gt;redirect_to&lt;/li&gt;
    &lt;li&gt;call&lt;/li&gt;
    &lt;li&gt;assign&lt;/li&gt;
    &lt;li&gt;&amp;lt;&amp;lt;&lt;/li&gt;

    &lt;li&gt;toggle&lt;/li&gt;
    &lt;li&gt;delay&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/p&gt;
    
&lt;h3&gt;Install&lt;/h3&gt;
    
    &lt;p class="h3"&gt;There are currently two ways to enable RJS templates in your rails app.  The simplest way is to update your rails app to use edge rails.  The second, slightly more involved way is to install RJS templates as a plugin.&lt;/p&gt;

    &lt;h4&gt;Edge Rails&lt;/h4&gt;
    
    &lt;p class="h4"&gt;&lt;i&gt;Edge Rails&lt;/i&gt; is a term that means you are running a local copy of the latest SVN trunk of Rails, instead of using gems. By checking out the trunk into your /vendor dir, Rails will automatically use that instead of the gems installed on your machine.&lt;/p&gt;

    &lt;p class="h4"&gt;The easiest way to get your rails app running on edge rails is to unpack the latest edge rails into your application vendor directory using the following command:&lt;/p&gt;
    
    &lt;p class="h4_alt"&gt;rake freeze_edge&lt;br /&gt;rake update_javascripts&lt;/p&gt;

    &lt;p class="h4"&gt;This puts the entire rails framework into your application. This also allows you to run on computers without rails installed.&lt;/p&gt;

    &lt;p class="h4"&gt;To undo it:&lt;/p&gt;

    &lt;p class="h4_alt"&gt;rake unfreeze_rails&lt;/p&gt;

    &lt;p class="h4"&gt;More info on Edge Rails can be found here: &lt;a href="http://wiki.rubyonrails.com/rails/pages/EdgeRails"&gt;http://wiki.rubyonrails.com/rails/pages/EdgeRails&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Plugin&lt;/h4&gt;

&lt;p class="h4"&gt;To install RJS Templates as a plugin, do the following:&lt;/p&gt;

&lt;p class="h4_alt"&gt;script/plugin discover&lt;/p&gt;

&lt;p class="h4"&gt;This will question you whether or not you want to add the plugin repositories that have been listed on the Rails Plugins wiki page to your local list of plugin repositories. Ensure that you add the codyfauser.com repository when prompted. You can ensure that you have the correct repositories by executing:&lt;/p&gt;

&lt;p class="h4_alt"&gt;script/plugin sources&lt;/p&gt;

&lt;p class="h4"&gt;Now do:&lt;/p&gt;

&lt;p class="h4_alt"&gt;script/plugin install javascript_generator_templates&lt;/p&gt;

&lt;p class="h4"&gt;Alternately if you don't want to add the codyfauser.com repository to your list of plugin sources you can install the plugin in one shot as follows:&lt;/p&gt;

&lt;p class="h4_alt"&gt;script/plugin install \&lt;br /&gt;http://www.codyfauser.com/svn/projects/plugins/javascript_generator_templates/&lt;/p&gt;


&lt;h3&gt;Example&lt;/h3&gt;

&lt;h4&gt;Categories List&lt;/h4&gt;

&lt;p class="h4"&gt;SQL:&lt;/p&gt;

&lt;pre&gt;&lt;p class="h4_alt"&gt;
&lt;span class="ident"&gt;CREATE TABLE&lt;/span&gt; &lt;span class="string"&gt;categories&lt;/span&gt; &lt;span class="punct"&gt;(&lt;/span&gt;

    &lt;span class="string"&gt;id serial&lt;/span&gt; &lt;span class="ident"&gt;NOT NULL&lt;/span&gt;,
    &lt;span class="string"&gt;name&lt;/span&gt; &lt;span class="ident"&gt;character varying&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="symbol"&gt;64&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
&lt;span class="punct"&gt;);&lt;/span&gt;
&lt;/p&gt;&lt;/pre&gt;

&lt;p class="h4"&gt;Initial Setup:&lt;/p&gt;

&lt;pre&gt;&lt;p class="h4_alt"&gt;
rails rjs_demo
cd rjs_demo
rake freeze_edge
rake update_javascripts
script/generate controller home index add
script/generate model category
&lt;/p&gt;&lt;/pre&gt;

&lt;p class="h4"&gt;View Template &lt;b&gt;app/views/home/index.rhtml:&lt;/b&gt;&lt;/p&gt;

&lt;pre&gt;&lt;p class="h4_alt"&gt;

&lt;span class="punct"&gt;&amp;lt;%=&lt;/span&gt;&lt;span class="ident"&gt; form_remote_tag&lt;/span&gt; :url =&amp;gt; { &lt;span class="string"&gt;:action&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;add&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; } &lt;span class="punct"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="string"&gt;

Category: &lt;span class="punct"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="ident"&gt;text_field&lt;/span&gt; 'category', 'name' &lt;/span&gt;&lt;span class="punct"&gt;%&amp;gt;&lt;/span&gt;
&lt;span class="punct"&gt;&amp;lt;%=&lt;/span&gt;&lt;span class="string"&gt; submit_tag 'Add' &lt;span class="punct"&gt;%&amp;gt;&lt;/span&gt;
&lt;span class="punct"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="ident"&gt;end_form_tag&lt;/span&gt; &lt;span class="punct"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="string"&gt;&lt;/span&gt;


&amp;lt;ul id=&amp;quot;categories&amp;quot;&amp;gt;
&lt;span class="punct"&gt;&amp;lt;%&lt;/span&gt; &lt;span class="attribute"&gt;@categories&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;each do |&lt;/span&gt;category&lt;span class="ident"&gt;|&lt;/span&gt; &lt;span class="punct"&gt;-%&amp;gt;&lt;/span&gt;
    &amp;lt;li&amp;gt;&lt;span class="punct"&gt;&amp;lt;%=&lt;/span&gt; category&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;name&lt;/span&gt; &lt;span class="punct"&gt;%&amp;gt;&lt;/span&gt;&amp;lt;/li&amp;gt;

&lt;span class="punct"&gt;&amp;lt;%&lt;/span&gt; &lt;span class="ident"&gt;end&lt;/span&gt; &lt;span class="punct"&gt;-%&amp;gt;&lt;/span&gt;
&amp;lt;/ul&amp;gt;
&lt;/p&gt;&lt;/pre&gt;

&lt;p class="h4"&gt;Nothing special, just a category list and a form to add more categories.  Note the &amp;lt;ul&amp;gt; tag is identified as 'categories'.  This would work the same if it were a &amp;lt;table&amp;gt; or &amp;lt;tbody&amp;gt;.&lt;/p&gt;

&lt;p class="h4"&gt;Controller Methods &lt;b&gt;app/controllers/home_controller.rb:&lt;/b&gt;&lt;/p&gt;

&lt;pre&gt;&lt;p class="h4_alt"&gt;
&lt;span class="keyword"&gt;class&lt;/span&gt; HomeController &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt; ApplicationController
    
    &lt;span class="keyword"&gt;def&lt;/span&gt; &lt;span class="method"&gt;index&lt;/span&gt;

    &lt;span class="attribute"&gt;@categories&lt;/span&gt; = &lt;span class="constant"&gt;Category&lt;/span&gt;&lt;span class
    ="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;find&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt; &lt;span class="symbol"&gt;:all&lt;/span&gt; &lt;span class="punct"&gt;)&lt;/span&gt;
    &lt;span class="keyword"&gt;end&lt;/span&gt;
    
    &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;add&lt;/span&gt;

    &lt;span class="attribute"&gt;@category&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Category&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt;
    &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="ident"&gt;request&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;post?&lt;/span&gt;
        &lt;span class="attribute"&gt;@category&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Category&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;create&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt; &lt;span class="ident"&gt;params&lt;/span&gt;&lt;span class="punct"&gt;[&lt;/span&gt;&lt;span class="symbol"&gt;:category&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt; &lt;span class="punct"&gt;)&lt;/span&gt;

    &lt;span class="keyword"&gt;end&lt;/span&gt;
    &lt;span class="keyword"&gt;end&lt;/span&gt;

&lt;span class="keyword"&gt;end&lt;/span&gt;
&lt;/p&gt;&lt;/pre&gt;

&lt;p class="h4"&gt;Posting adds the category to the database and assigns it to @category which will be used in the RJS template.  After the action completes it looks for a template named add.*, and ours is called add.rjs so it uses that.&lt;/p&gt;

&lt;p class="h4"&gt;RJS Template &lt;b&gt;app/views/home/add.rjs:&lt;/b&gt;&lt;/p&gt;

&lt;pre&gt;&lt;p class="h4_alt"&gt;
&lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="attribute"&gt;@category&lt;/span&gt; &lt;span class="punct"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="attribute"&gt;@category&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;errors&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;li&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;content_tag&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;li&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="attribute"&gt;@category&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;name&lt;/span&gt; &lt;span class="punct"&gt;)&lt;/span&gt;

    &lt;span class="ident"&gt;page&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;insert_html&lt;/span&gt; &lt;span class="symbol"&gt;:bottom&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;categories&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="ident"&gt;li&lt;/span&gt;
    &lt;span class="ident"&gt;page&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;visual_effect&lt;/span&gt; &lt;span class="symbol"&gt;:highlight&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; '&lt;span class="string"&gt;categories&lt;/span&gt;'&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="symbol"&gt;:duration&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="symbol"&gt;3&lt;/span&gt;

&lt;span class="keyword"&gt;end&lt;/span&gt;
&lt;/p&gt;&lt;/pre&gt;

&lt;p class="h4"&gt;If the category was created with no errors then we add it to the bottom of the 'categories' list.  The magic here is the 'page' object.  With the page object you can work on most any element in the html document.  All the methods listed at the top are available.&lt;/p&gt;</description>
      <pubDate>Mon, 06 Feb 2006 13:46:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:1a1093b4-6846-4cb8-bc29-53d9cc306ff9</guid>
      <author>greg</author>
      <link>http://rewrite.rickbradley.com/articles/2006/02/06/rjs-templates</link>
      <category>ruby on rails</category>
      <category>ruby</category>
      <category>rails</category>
      <category>greg</category>
      <category>rjs</category>
      <category>template</category>
    </item>
    <item>
      <title>Selenium for Rails, finally?</title>
      <description>&lt;p&gt;&lt;a href="http://jutopia.tirsen.com/articles/2006/02/06/selenium-and-rails"&gt;Jon Tirsen&lt;/a&gt; pointed out that there&amp;#8217;s what appears to be a full-featured &lt;a href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails"&gt;Selenium on Rails&lt;/a&gt; plugin now available.  We&amp;#8217;ve been eyeing Selenium to help us with automating browser tests and acceptance tests, but have been sort of waiting for the dust to settle to see which approach at Rails integration is going to be the best.  This plugin wasn&amp;#8217;t even on our radar, but it looks really promising.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: Speaking of not on our radar&amp;#8212;there&amp;#8217;s also a new &lt;a href="http://www.openqa.org/selenium-ide/"&gt;Selenium &lt;span class="caps"&gt;IDE&lt;/span&gt;&lt;/a&gt; that&amp;#8217;s a Firefox extension for (among other things) writing Selenium tests.  Crazy.&lt;/p&gt;</description>
      <pubDate>Mon, 06 Feb 2006 09:11:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:f61d04d2-4b8e-4314-8645-2334d2115914</guid>
      <author>rick</author>
      <link>http://rewrite.rickbradley.com/articles/2006/02/06/selenium-for-rails-finally</link>
      <category>ruby on rails</category>
      <category>testing</category>
      <category>rails</category>
      <category>selenium</category>
      <category>testing</category>
      <category>rick</category>
    </item>
  </channel>
</rss>
