<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Startups On Rails</title>
	<atom:link href="http://www.startupsonrails.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.startupsonrails.com</link>
	<description>startups.each { &#124;startup&#124; startup.code.inspect }</description>
	<lastBuildDate>Thu, 29 Nov 2007 21:55:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>href_to_params</title>
		<link>http://www.startupsonrails.com/?p=14</link>
		<comments>http://www.startupsonrails.com/?p=14#comments</comments>
		<pubDate>Tue, 27 Nov 2007 21:55:45 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Rails Hacks]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.startupsonrails.com/?p=14</guid>
		<description><![CDATA[Every now and then I find myself in need of the ability to take a string like &#8220;http://www.estately.com/p/WA_Seattle&#8221; and figure out the params hash that it would generate &#8211; the method to do that in rails isn&#8217;t immediately obvious, but after a little digging, I&#8217;m happy to say it isn&#8217;t too hard. I admit, I [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then I find myself in need of the ability to take a string like &#8220;http://www.estately.com/p/WA_Seattle&#8221; and figure out the params hash that it would generate &#8211; the method to do that in rails isn&#8217;t immediately obvious, but after a little digging, I&#8217;m happy to say it isn&#8217;t too hard.</p>
<p>I admit, I generally treat Routing as a black box: type a url in the browser and I get a params hash &#8211; works for me.  I thought I was in for some serious digging to figure this one out, but it turns out it already exists, but only for testing under the name assert_recognizes.  Adding the ability to recognize query strings, I came up with the following:</p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
  ##
  #accepts a href string and returns a params hash
  #href can optionally include the host
  #assumes the request_method is get
  def href_to_params(href)
    uri = URI.parse(href)

    #make a fake request and send it through routing
    request = ActionController::TestRequest.new({}, {}, nil)
    request.path = uri.path
    ActionController::Routing::Routes.recognize(request)

    #manually add query params
    query_hash = CGI::parse(uri.query.to_s)
    query_hash.each {|k,v| query_hash[k] = v.size == 1 ? v.first : v}

    HashWithIndifferentAccess.new(query_hash.merge(request.path_parameters))
  end
</textarea>
<p>This was with about 30 minutes of research, so there very well could be a better way, but this works well for me.  If anyone knows a cleaner method I&#8217;d love to hear about it.</p>
<p><strong>Update</strong>:<br />
 I missed it during development, all the tests passed, but there&#8217;s something missing from above:</p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
require File.join(RAILS_ROOT, 'vendor/rails/actionpack/lib/action_controller/test_process.rb')
</textarea>
<p>TestRequest can&#8217;t be auto-loaded by rails because it&#8217;s in a file called test_process.rb, and of course this wasn&#8217;t caught with tests as it is already loaded in the testing environment, guess TDD can&#8217;t save you from yourself.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.startupsonrails.com/?feed=rss2&amp;p=14</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Ode to the cool American Nerd: Jamis Buck</title>
		<link>http://www.startupsonrails.com/?p=11</link>
		<comments>http://www.startupsonrails.com/?p=11#comments</comments>
		<pubDate>Sat, 18 Aug 2007 02:35:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[not code]]></category>

		<guid isPermaLink="false">http://www.startupsonrails.com/?p=11</guid>
		<description><![CDATA[Take a look at the pictures in this post. Who&#8217;s the real nerd? Jamis Buck or the pretty boys posing in the hallway? We all know the answer. Those guys didn&#8217;t play D&#38;D after the age of 13. It&#8217;s Jamis, one of the clearest writers, one of the best OSS contributors and one of the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.startupsonrails.com/wp-content/uploads/2007/08/37signals.jpg" alt="Pretty Boys" /></p>
<p><img src="http://www.startupsonrails.com/wp-content/uploads/2007/08/jamis.jpg" alt="Jamis" /></p>
<p><a href="http://www.akitaonrails.com/2007/8/3/chatting-with-jamis-buck">Take a look at the pictures in this post</a>. Who&#8217;s the real nerd? <a href="http://weblog.jamisbuck.org/">Jamis Buck</a> or the pretty boys posing in the hallway?</p>
<p>We all know the answer. Those guys didn&#8217;t play D&amp;D after the age of 13. It&#8217;s Jamis, one of the clearest writers, one of the best OSS contributors and one of the nicest people in the rails community.  Call me old fashioned, but I don&#8217;t trust coders who look like that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.startupsonrails.com/?feed=rss2&amp;p=11</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mechanical Turk Gem</title>
		<link>http://www.startupsonrails.com/?p=10</link>
		<comments>http://www.startupsonrails.com/?p=10#comments</comments>
		<pubDate>Tue, 05 Jun 2007 14:45:39 +0000</pubDate>
		<dc:creator>galen</dc:creator>
				<category><![CDATA[Mechanical Turk]]></category>
		<category><![CDATA[gems]]></category>

		<guid isPermaLink="false">http://www.startupsonrails.com/?p=10</guid>
		<description><![CDATA[Amazon&#8217;s mechanical turk gem 0.90 was released a couple of days ago (download here). We aren&#8217;t using Mechanical Turk yet, bu I have a myriad of things I&#8217;d like to try it on. Mechanical Turk is brilliant, but it seems a unnecessarily complicated on the developer side. The documentation is thorough, but I couldn&#8217;t find [...]]]></description>
			<content:encoded><![CDATA[<p>Amazon&#8217;s <a href="http://solutions.amazonwebservices.com/connect/thread.jspa?messageID=60133&amp;tstart=0">mechanical turk gem 0.90</a> was released a couple of days ago (<a href="http://developer.amazonwebservices.com/connect/entry.jspa?entryID=793&amp;ref=featured">download here</a>). We aren&#8217;t using Mechanical Turk yet, bu I have a myriad of things I&#8217;d like to try it on.</p>
<p>Mechanical Turk is brilliant, but it seems a unnecessarily complicated on the developer side.  <a href="http://docs.amazonwebservices.com/AWSMechanicalTurkRequester/2005-10-01/">The documentation is thorough</a>, but I couldn&#8217;t find a good step by step walk through for posting &#8216;hits&#8217; and getting results. The sample <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=447">&#8220;get your balance&#8221; code </a>doesn&#8217;t really cut it for this mechanical n00b. <a href="http://www.awszone.com/forms/qap.form">This form is nice for one-offs</a>. The docs don&#8217;t hold a light to the <a href="http://www.google.com/apis/maps/documentation/index.html">Google Maps api docs</a>.</p>
<p>I&#8217;ll be sure to post a rudimentary how-to when we at last get around to utilizing The Turk.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.startupsonrails.com/?feed=rss2&amp;p=10</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script/generate and add to svn at the same time</title>
		<link>http://www.startupsonrails.com/?p=9</link>
		<comments>http://www.startupsonrails.com/?p=9#comments</comments>
		<pubDate>Fri, 01 Jun 2007 22:23:04 +0000</pubDate>
		<dc:creator>galen</dc:creator>
				<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://www.startupsonrails.com/?p=9</guid>
		<description><![CDATA[I&#8217;m probably the last to know how to add files to svn as you are generating them. Add -c to your command: script/generate migration likeability_to_homes -c And you don&#8217;t have to svn add your way to carpel tunnel.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m probably the last to know how to add files to svn as you are generating them.  Add -c to your command:</p>
<p><code>script/generate migration likeability_to_homes -c</code></p>
<p>And you don&#8217;t have to svn add your way to carpel tunnel.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.startupsonrails.com/?feed=rss2&amp;p=9</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>If you aren&#8217;t using Firebug yet, you should be</title>
		<link>http://www.startupsonrails.com/?p=8</link>
		<comments>http://www.startupsonrails.com/?p=8#comments</comments>
		<pubDate>Wed, 21 Mar 2007 18:40:03 +0000</pubDate>
		<dc:creator>galen</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.startupsonrails.com/?p=8</guid>
		<description><![CDATA[We&#8217;ve decided that if it cost money, we would pay for Firebug. Since I installed it, I&#8217;ve found myself tweaking a lot of designs in Firebug. It&#8217;s especially helpful if you want to see what a page would look like with our without specific styles or if you can&#8217;t figure out why certain elements are [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve decided that if it cost money, we would pay for <a href="https://addons.mozilla.org/firefox/1843/">Firebug</a>.</p>
<p>Since I installed it, I&#8217;ve found myself tweaking a lot of designs in <a href="https://addons.mozilla.org/firefox/1843/">Firebug</a>. It&#8217;s especially helpful if you want to see what a page would look like with our without specific styles or if you can&#8217;t figure out why certain elements are getting styled the way they are. Sometimes, when I want to add an element to <a href="http://www.shackprices.com/">ShackPrices</a>, I find the element I want to add it to and start editing the html in Firebug. It&#8217;s incredible how much more productive I can be with instant feedback (4px padding? no 5px looks better). When I&#8217;m done, I just cut and paste the html into Vim.</p>
<p>Additionally, for you ajax nerds, Firebug shows you the contents and type of every ajax call and the contents of the response, so you don&#8217;t have to spend as much time looking at your logs.</p>
<p>If you aren&#8217;t using it already, <a href="https://addons.mozilla.org/firefox/1843/">give it a try</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.startupsonrails.com/?feed=rss2&amp;p=8</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Null Object Pattern for Users</title>
		<link>http://www.startupsonrails.com/?p=6</link>
		<comments>http://www.startupsonrails.com/?p=6#comments</comments>
		<pubDate>Thu, 22 Feb 2007 03:12:20 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://www.startupsonrails.com/?p=6</guid>
		<description><![CDATA[The Null Object Pattern certainly isn&#8217;t a new idea, but it&#8217;s simple and can really help clean up some code, so I thought I&#8217;d share an example. Background Our login system is based off of acts_as_authenticated, but very few of our pages require a user to be logged in. We want to find out about [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://en.wikipedia.org/wiki/Null_Object_pattern">Null Object Pattern</a> certainly isn&#8217;t a new idea, but it&#8217;s simple and can really help clean up some code, so I thought I&#8217;d share an example.</p>
<p><strong>Background</strong><br />
Our login system is based off of acts_as_authenticated, but very few of our pages require a user to be logged in.  We want to find out about the current user, but first we need to make sure they are logged in, otherwise current_user will return nil and you&#8217;ll end up with a NoMethodError.  So we end up with a lot of code that looks like this:</p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
if(logged_in? &amp;&amp; current_user.is_saved_property?(@house))
</textarea>
<p>Not too bad, but this pattern shows up <em>all the time</em> in our code.</p>
<p><strong>A Solution</strong><br />
Null Object to the rescue!  The idea is dead simple: instead of returning nil if the user isn&#8217;t logged in, just return  a instance of a new class &#8211; NilUser.</p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
class NilUser
def is_saved_property?(*args)
return false
end
end
</textarea>
<p>Now we just update current_user to return a NilUser if the user isn&#8217;t logged in:</p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
def current_user
logged_in? ? @current_user : nil_user
end
def nil_user
@nil_user ||= NilUser.new
end
</textarea>
<p>Now all of our conditionals are shortened to a single condition, much nicer.</p>
<p><strong>Final Words</strong><br />
If you try something along these lines, just remember to add corresponding methods to your new class for each public method of the class you are potentially replacing.  If you felt like living dangerously you could even add a method_missing to your nil class that returned nil on any undefined methods and only define methods where you wanted a different return value &#8211; but this could easily turn into a debugging nightmare.</p>
<p>Also make sure to update any code where you depended the returned object being nil &#8211; for example:</p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
#BAD!
if current_user
#code that assumes the user is logged in
end
</textarea>
<p>will be broken.  You might even need to add another method to your Null Object class, something like:</p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
def nil?
true
end
</textarea>
<p>In our case we can use logged_in? if all we want to know is whether a user is logged in or not.</p>
<p>That&#8217;s all there is to it!  While not something you&#8217;d want to use all the time, when used appropriately it can help cut a lot of repeated code in your conditionals and improve the code&#8217;s readability.</p>
<p><strong>Next Post: A little meta-programming to simplify the nil class definition</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.startupsonrails.com/?feed=rss2&amp;p=6</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rad Rad Rad Gems and Plugins for rails</title>
		<link>http://www.startupsonrails.com/?p=5</link>
		<comments>http://www.startupsonrails.com/?p=5#comments</comments>
		<pubDate>Thu, 15 Feb 2007 05:45:32 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://www.startupsonrails.com/?p=5</guid>
		<description><![CDATA[Things have come a long way since the first project I developed on rails. Starting out I wanted to keep things simple but now I can’t get enough of the time saving complexity that many great gems and plugins bring! So here they are, in no particular order at all, a few of the recent [...]]]></description>
			<content:encoded><![CDATA[<p>Things have come a long way since the <a href="http://immedi.at">first</a> project I developed on rails. Starting out I wanted to keep things simple but now I can’t get enough of the time saving complexity that many great gems and plugins bring!</p>
<p>So here they are, in no particular order at all, a few of the recent tips, tricks, plugins and gems I’ve found to be <strong>rad rad rad</strong>.</p>
<p><a href="http://www.zenspider.com/ZSS/Products/ZenTest/">ZenTest</a><br />
If you’re not testing you’re wasting valuable time. If you’re testing but not using ZenTest you’re still wasting valuable time. In particular, <strong>autotest</strong> (a part of the ZenTest gem) is a brilliantly simple approach to reducing &#8212; as much as I’ve ever seen done &#8212; the gap between test and code. You run it and it tests your code whenever and as soon as you change it. <strong>Rad rad rad</strong>.</p>
<p><a href="http://piston.rubyforge.org/usage.html">Piston</a><br />
You’ve got plugins or you’re working on the edge and you want that 3rd party code to be up-to-date, right? How annoying is it to re-install that stuff and re-import it into your source tree? Piston acts as an interface between your source tree and the source trees of your 3rd party applications and plugins. <code>piston update</code> and you’re source suddenly has an up-to-date copy, committed and ready to go.</p>
<p><a href="http://ferret.davebalmain.com/trac/">ferret </a><br />
Hello full text search! This port of the popular, well-designed Java search system <a href="http://lucene.apache.org/">Lucene</a>, is an easy way to effectively index the plain text in your models. I find it to be a better fit for most of my projects than MYSQL <a href="http://dev.mysql.com/doc/en/Fulltext_Search.html">full text</a> indexing because it exists separately from the database and is explicitly designed for text search.</p>
<p><a href="http://manuals.rubyonrails.com/read/book/17">capistrano</a><br />
If you’re not using this deployment management tool you’re wasting precious time! It&#8217;s simple to setup and easy to use. Let’s see, let me go to my rails root. I’ll enter <code>cap deploy</code>. 1, 2, 3, 4, 5 seconds later and I have the latest version of my source installed, my application servers have been reset, the database migrated, AND I’ve got a complete copy of the last deploy to rollback too if need be. Oh and it resets my backgroundrb (see below) processes plus a bunch of other custom stuff I wrote. <strong>Rad Rad Rad.</strong></p>
<p><a href="http://backgroundrb.rubyforge.org/">backgroundrb</a><br />
In the Java world this would be called <a href="http://www.opensymphony.com/quartz/">Quartz</a>. In the ruby world its just as indispensable. Perhaps not when you’re starting out, but pretty early on you can be sure you’ll need to run, on an automated basis, various scripts. I use it to manage the sending of emails so that I don’t tie up my mongrel application processes. I also use it to do database and session cleanup.</p>
<p><a href="http://www.redhillconsulting.com.au/rails_plugins.html">RedHill Consulting Plugins, et al</a><br />
These guys offer a series of plugins so simple and useful they feel like they ought to have been a part of rails itself. <strong>foreign_key_migrations</strong> is a plugin that automagically creates indexes in your database based on your database schema. A users table which references a <em>article_id</em> will automatically get an foreign key index to the articles table. Rad rad rad. (This can create some hassle with your test fixtures though, since you won’t be able to insert data with bad references.)</p>
<p><a href="http://dev.rubyonrails.org/svn/rails/plugins/exception_notification/README">Exception Notification</a><br />
This plugin is a life saver! And pretty annoying too! It makes it easy to get an email detailing what happened when something goes wrong with your rails app.</p>
<p><a href="http://svn.techno-weenie.net/projects/plugins/routing_navigator/">Routing Navigator</a><br />
This handy plugin can really help with the transition from your old rails app to your new RESTful application by displaying information about all the routes and named route methods being generated by your routes.rb</p>
<p><a href="http://dev.rubyonrails.org/svn/rails/plugins/simply_helpful/">Simply Helpful</a><br />
Written by DHH himself, this set of helpers and methods simplifies a lot of common tasks. <code>polymorphic_url(object)</code> generates the correct URL for any model which has coverage in your routes.rb. <code>dom_id(object)</code> will create a class + id based identifier which you can reference in your RJS scripts and HTML to ensure everything gets wired up correctly. Handy!</p>
<p><a href="http://svn.cardboardrocket.com/paginating_find/">Paginating Find</a><br />
I’ve just started using this one but it looks great. Instead of using this weird extra pagination method, paginating find adds a few simple options to the built in find command to more efficiently allow you to select out pages of models.</p>
<p><a href="http://opensvn.csie.org/rails_file_column/plugins/file_column">File Column</a><br />
Though not updated in a while, this plugin makes it super easy to add files to model objects. In particular, it handles images very well and has great integration with <a href="http://rmagick.rubyforge.org/">rmagick</a> to automatically do things like image resizing and version management.</p>
<p><a href="http://wagglelabs.com">Validates Url</a><br />
A little something I wrote, this guy does simple validation on model fields to check that they have a certain protocol and are correctly formed server/path strings.</p>
<hr size="1" />
My name is Peter T. Brown. I am a partner at <a href="http://wagglelabs.com">Waggle Laboratories, LLC</a> which develops lightweight social applications for business and pleasure. Our latest and greatest is <a href="http://realityallstarz.com">RealityAllStarz</a> where you earn points for doing unusual and interesting things!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.startupsonrails.com/?feed=rss2&amp;p=5</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Business geeks on their true passion: code</title>
		<link>http://www.startupsonrails.com/?p=4</link>
		<comments>http://www.startupsonrails.com/?p=4#comments</comments>
		<pubDate>Tue, 13 Feb 2007 23:58:48 +0000</pubDate>
		<dc:creator>galen</dc:creator>
				<category><![CDATA[not code]]></category>

		<guid isPermaLink="false">http://www.startupsonrails.com/?p=4</guid>
		<description><![CDATA[Normally I&#8217;d suggest starting a blog about code by just jumping in &#8211; it ain&#8217;t a blog about talking, right? But I&#8217;ll disregard my own advice and give you a little background first. Doug and I started ShackPrices.com a little over a year ago and settled on Ruby on Rails a couple of months later. [...]]]></description>
			<content:encoded><![CDATA[<p>Normally I&#8217;d suggest starting a blog about code by just jumping in &#8211; it ain&#8217;t a blog about talking, right? But I&#8217;ll disregard my own advice and give you a little background first.</p>
<p>Doug and I started <a href="http://shackprices.com/">ShackPrices.com</a> a little over a year ago and settled on Ruby on Rails a couple of months later. We learned Ruby and Rails via the traditional route &#8211; purusing the ten million &#8220;do X in 15 minutes with rails&#8221; stories on the web, reading through the Pragmatic Programmers Rails book and finally turning to the API and some solid rails blogs including:</p>
<p><a href="http://errtheblog.com/">err.the_blog</a><br />
<a href="http://nubyonrails.com/">Nuby on Rails</a><br />
<a href="http://www.rubyinside.com/">Ruby Inside<br />
</a><a href="http://blog.hasmanythrough.com/">has many through</a><br />
(and many more)</p>
<p>We found that blog posts are often the best and most effective documents for learning more about Ruby and about Rails.</p>
<p>Every so often we create our own solution that so impresses us that we want to share it with the community, but we don&#8217;t have the time (or the abundance of genius) to post often enough to make a stand alone blog.  So we&#8217;re putting together a blog where we can post our insights along with insights from a bunch of other rails-driven startup founder / coders. Hence &#8220;Startups on Rails.&#8221;</p>
<p>We&#8217;ll be introducing those other contributors in the coming few weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.startupsonrails.com/?feed=rss2&amp;p=4</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
