<?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"
	>

<channel>
	<title>BrewSession Blog</title>
	<atom:link href="http://blog.brewsession.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.brewsession.com</link>
	<description>Thoughts on Brewing Better Beer</description>
	<pubDate>Thu, 03 Jul 2008 01:26:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Australian Ale Style Descriptions</title>
		<link>http://blog.brewsession.com/2008/07/02/australian-ale-style-descriptions/</link>
		<comments>http://blog.brewsession.com/2008/07/02/australian-ale-style-descriptions/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 01:19:11 +0000</pubDate>
		<dc:creator>gregr</dc:creator>
		
		<category><![CDATA[Greg]]></category>

		<category><![CDATA[related]]></category>

		<category><![CDATA[ale]]></category>

		<category><![CDATA[australian]]></category>

		<category><![CDATA[BJCP]]></category>

		<category><![CDATA[styles]]></category>

		<guid isPermaLink="false">http://blog.brewsession.com/?p=41</guid>
		<description><![CDATA[Just a quick plug to check out The Missing BJCP Styles, part 2: Going Down Under with Australian Ales over on my personal blog.  In this post, I cover Australian Pale/Sparkling Ale, Australian Dark Ale, and Australian Wheat Beer.  I&#8217;ll be following that up shortly with a post on Australian Lagers. As with [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick plug to check out <a href="http://www.gregroe.com/2008/07/02/the-missing-bjcp-styles-part-2-going-down-under-with-australian-ales/">The Missing BJCP Styles, part 2: Going Down Under with Australian Ales</a> over on my personal blog.  In this post, I cover Australian Pale/Sparkling Ale, Australian Dark Ale, and Australian Wheat Beer.  I&#8217;ll be following that up shortly with a post on Australian Lagers. As with all the styles in the &#8220;Missing Styles&#8221; series, BrewSession will include these Australian styles in its style list.</p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F07%2F02%2Faustralian-ale-style-descriptions%2F&amp;title=Australian+Ale+Style+Descriptions" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F07%2F02%2Faustralian-ale-style-descriptions%2F&amp;title=Australian+Ale+Style+Descriptions" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F07%2F02%2Faustralian-ale-style-descriptions%2F&amp;title=Australian+Ale+Style+Descriptions" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F07%2F02%2Faustralian-ale-style-descriptions%2F&amp;title=Australian+Ale+Style+Descriptions" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F07%2F02%2Faustralian-ale-style-descriptions%2F&amp;title=Australian+Ale+Style+Descriptions', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.brewsession.com%2F2008%2F07%2F02%2Faustralian-ale-style-descriptions%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fblog.brewsession.com%2F2008%2F07%2F02%2Faustralian-ale-style-descriptions%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.brewsession.com%2F2008%2F07%2F02%2Faustralian-ale-style-descriptions%2F&amp;title=Australian+Ale+Style+Descriptions" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F07%2F02%2Faustralian-ale-style-descriptions%2F&amp;title=Australian+Ale+Style+Descriptions" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://blog.brewsession.com/2008/07/02/australian-ale-style-descriptions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Problematic Decimal Arithmetic in Javascript</title>
		<link>http://blog.brewsession.com/2008/06/28/problematic-decimal-arithmetic-in-javascript/</link>
		<comments>http://blog.brewsession.com/2008/06/28/problematic-decimal-arithmetic-in-javascript/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 06:09:10 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
		
		<category><![CDATA[Dean]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.brewsession.com/?p=40</guid>
		<description><![CDATA[It is a pretty well known fact that using javascript to add decimals 0.1 with 0.2 does not result in 0.3. [1] Try it yourself with the FireBug console.  For the uninitiated, the problem stems from javascript&#8217;s internal representation of numbers.  They are actually binary numbers that are usually exact, but sometimes for [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">It is a pretty well known fact that using javascript to add decimals 0.1 with 0.2 does not result in 0.3. <sup>[<a href="#ref1">1</a>]</sup> Try it yourself with the FireBug console.  For the uninitiated, the problem stems from javascript&#8217;s internal representation of numbers.  They are actually binary numbers that are usually exact, but sometimes for example, are <em>0.00000000000000004</em> off.  This is particularly aggravating when writing calculators that rely on js to give accurate results.</p>
<p style="text-align: justify;">In my text inputs I was using toFixed() and some magic HTML attributes to keep decimals nice and clean.  However, this method breaks down when a user enters a number with more significant figures than initially set up or you try to operate on two numbers with different sig figs.  It was probably inevitable that I use a little arithmetic library extending <em>Number</em> to make decimals play nice.</p>
<p style="text-align: justify;">Since javascript is 13 years old I thought it would be a simple thing to find such a library.  I was wrong.  After four days learning, looking and lamenting I had no library.  After putting this one together in about a day and a half I am not surprised that nobody published theirs.  Most of the eleven functions are one-liners, yet it bothers me that there are probably thirty-odd implementations of the this out there and not one found through Google.</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1"><span class="co1">// decimal_arithmetic.js</span></div>
</li>
<li class="li1">
<div class="de1">String.<span class="me1">prototype</span>.<span class="me1">digitsAfterDecimal</span> = <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span> &nbsp;<span class="kw2">var</span> parts = <span class="kw1">this</span>.<span class="me1">split</span><span class="br0">&#40;</span><span class="st0">&quot;.&quot;</span>, <span class="nu0">2</span><span class="br0">&#41;</span>; &nbsp;<span class="co1">// FIXME: Not international!</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">if</span><span class="br0">&#40;</span> ! parts<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp;<span class="br0">&#123;</span> &nbsp;parts<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> = <span class="st0">&quot;&quot;</span>; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">return</span> parts<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">length</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">Number.<span class="me1">prototype</span>.<span class="me1">biggerScalar</span> = <span class="kw2">function</span><span class="br0">&#40;</span>n<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#123;</span> &nbsp;<span class="kw1">return</span> n.<span class="me1">scale</span><span class="br0">&#40;</span><span class="br0">&#41;</span> &gt; <span class="kw1">this</span>.<span class="me1">scale</span><span class="br0">&#40;</span><span class="br0">&#41;</span> ? n.<span class="me1">scale</span><span class="br0">&#40;</span><span class="br0">&#41;</span> : <span class="kw1">this</span>.<span class="me1">scale</span><span class="br0">&#40;</span><span class="br0">&#41;</span>; &nbsp;<span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">Number.<span class="me1">prototype</span>.<span class="me1">digitsAfterDecimal</span> = <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span> &nbsp;<span class="kw1">return</span> <span class="kw1">this</span>.<span class="me1">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">digitsAfterDecimal</span><span class="br0">&#40;</span><span class="br0">&#41;</span>; &nbsp;<span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">Number.<span class="me1">prototype</span>.<span class="me1">divided</span> = <span class="kw2">function</span><span class="br0">&#40;</span>n<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span> &nbsp;<span class="kw1">return</span> <span class="kw1">this</span>.<span class="me1">dividedBy</span><span class="br0">&#40;</span>n<span class="br0">&#41;</span>; &nbsp;<span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">Number.<span class="me1">prototype</span>.<span class="me1">dividedBy</span> = <span class="kw2">function</span><span class="br0">&#40;</span>n<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span> &nbsp;<span class="kw1">return</span> <span class="kw1">this</span>.<span class="me1">multiply</span><span class="br0">&#40;</span> n.<span class="me1">reciprocal</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span>; &nbsp;<span class="br0">&#125;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">Number.<span class="me1">prototype</span>.<span class="me1">minus</span> = <span class="kw2">function</span><span class="br0">&#40;</span>n<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span> &nbsp;<span class="kw1">return</span> <span class="kw1">this</span>.<span class="me1">plus</span><span class="br0">&#40;</span> n.<span class="me1">negative</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span>; &nbsp;<span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">Number.<span class="me1">prototype</span>.<span class="me1">multiply</span> = <span class="kw2">function</span><span class="br0">&#40;</span>n<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#123;</span> &nbsp;<span class="kw2">var</span> s = <span class="kw1">this</span>.<span class="me1">biggerScalar</span><span class="br0">&#40;</span>n<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">return</span> <span class="br0">&#40;</span>Math.<span class="me1">round</span><span class="br0">&#40;</span>s*<span class="kw1">this</span>,<span class="nu0">0</span><span class="br0">&#41;</span> * Math.<span class="me1">round</span><span class="br0">&#40;</span>s*n,<span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#41;</span> / <span class="br0">&#40;</span>s*s<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">Number.<span class="me1">prototype</span>.<span class="me1">negative</span> = <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#123;</span> &nbsp;<span class="kw1">return</span> <span class="nu0">-1</span> * <span class="kw1">this</span>; &nbsp;<span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">Number.<span class="me1">prototype</span>.<span class="me1">plus</span> = <span class="kw2">function</span><span class="br0">&#40;</span>n<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span> &nbsp;<span class="kw2">var</span> s = <span class="kw1">this</span>.<span class="me1">biggerScalar</span><span class="br0">&#40;</span>n<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">return</span> <span class="br0">&#40;</span>Math.<span class="me1">round</span><span class="br0">&#40;</span>s*<span class="kw1">this</span>,<span class="nu0">0</span><span class="br0">&#41;</span> + Math.<span class="me1">round</span><span class="br0">&#40;</span>s*n,<span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#41;</span> / s;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">Number.<span class="me1">prototype</span>.<span class="me1">reciprocal</span> = <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span> &nbsp;<span class="kw1">return</span> <span class="nu0">1</span> / <span class="kw1">this</span>; &nbsp;<span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">Number.<span class="me1">prototype</span>.<span class="me1">scale</span> = <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span> &nbsp;<span class="kw1">return</span> Math.<span class="me1">pow</span><span class="br0">&#40;</span><span class="nu0">10</span>, <span class="kw1">this</span>.<span class="me1">digitsAfterDecimal</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span>; &nbsp;<span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>Now you can do magical things like:</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1"><span class="nu0">0.1</span>.<span class="me1">plus</span><span class="br0">&#40;</span><span class="nu0">0.2</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// 0.3</span></div>
</li>
</ol>
</div>
<p>yielding the correct results.</p>
<p style="text-align: justify;">I am looking forward to javascript 2.0 when I can override the + operator.  Maybe I won&#8217;t go that far since binary arithmetic is still faster.</p>
<p><a name="ref1"></a>[<a href="#ref1_back">1</a>] <a href="http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/6ebdd806d1a478b7/6a400346d203dcb5">http://groups.google.com/group/comp.lang.javascript/&#8230;</a></p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F06%2F28%2Fproblematic-decimal-arithmetic-in-javascript%2F&amp;title=Problematic+Decimal+Arithmetic+in+Javascript" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F06%2F28%2Fproblematic-decimal-arithmetic-in-javascript%2F&amp;title=Problematic+Decimal+Arithmetic+in+Javascript" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F06%2F28%2Fproblematic-decimal-arithmetic-in-javascript%2F&amp;title=Problematic+Decimal+Arithmetic+in+Javascript" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F06%2F28%2Fproblematic-decimal-arithmetic-in-javascript%2F&amp;title=Problematic+Decimal+Arithmetic+in+Javascript" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F06%2F28%2Fproblematic-decimal-arithmetic-in-javascript%2F&amp;title=Problematic+Decimal+Arithmetic+in+Javascript', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.brewsession.com%2F2008%2F06%2F28%2Fproblematic-decimal-arithmetic-in-javascript%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fblog.brewsession.com%2F2008%2F06%2F28%2Fproblematic-decimal-arithmetic-in-javascript%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.brewsession.com%2F2008%2F06%2F28%2Fproblematic-decimal-arithmetic-in-javascript%2F&amp;title=Problematic+Decimal+Arithmetic+in+Javascript" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F06%2F28%2Fproblematic-decimal-arithmetic-in-javascript%2F&amp;title=Problematic+Decimal+Arithmetic+in+Javascript" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://blog.brewsession.com/2008/06/28/problematic-decimal-arithmetic-in-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Missing Beer Styles, Making it into BrewSession</title>
		<link>http://blog.brewsession.com/2008/04/23/the-missing-beer-styles-making-it-into-brewsession/</link>
		<comments>http://blog.brewsession.com/2008/04/23/the-missing-beer-styles-making-it-into-brewsession/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 05:28:18 +0000</pubDate>
		<dc:creator>gregr</dc:creator>
		
		<category><![CDATA[Greg]]></category>

		<category><![CDATA[features]]></category>

		<category><![CDATA[related]]></category>

		<category><![CDATA[Beer Styles]]></category>

		<category><![CDATA[BJCP]]></category>

		<guid isPermaLink="false">http://blog.brewsession.com/?p=35</guid>
		<description><![CDATA[Sticke Alt, Australian Sparkling Ale, Leipziger Gose, Classic American Cream Ale, Imperial Lager.  What do all these beer styles have in common?  Done guessing?  Hint: They&#8217;re not in the Beer Judges Certification Program Style Guidelines.  Nor are a lot of other lesser-known beer styles.  The BJCP Style Guide is the main source of style guidelines [...]]]></description>
			<content:encoded><![CDATA[<p>Sticke Alt, Australian Sparkling Ale, Leipziger Gose, Classic American Cream Ale, Imperial Lager.  What do all these beer styles have in common?  Done guessing?  Hint: They&#8217;re not in the Beer Judges Certification Program Style Guidelines.  Nor are a lot of other lesser-known beer styles.  The BJCP Style Guide is the main source of style guidelines used by home and microbrewers in the US, and beyond.  But it has its purpose, educating beer judges.  For a brewer, it&#8217;s just not quite complete.</p>
<p>As noted previously, we&#8217;ll be including the FULL <a href="http://www.bjcp.org/stylecenter.html">BJCP Beer Style Guidelines</a> in BrewSession.  However, lately, as I&#8217;ve brewed my last few batches of beer that didn&#8217;t fall into a BJCP specified style, I started thinking about those &#8220;missing styles&#8221;.</p>
<p>Certainly there are many, many modern and ancient styles that aren&#8217;t in the BJCP style guidelines.  Some are just too obscure, some are even commercially extinct.  But there are some styles that, still, deserve to be recognized &#8230; somehow.</p>
<p>Some of these obscure styles even get brief mentions in the <a href="http://www.bjcp.org/stylecenter.html">BJCP Style Guide</a> as part of another similar or contrasting style.  Others are mentioned in <a href="http://www.bjcp.org/styles04/Category23.html">BJCP Style Category 23A</a> which is purposely labeled a “catch-all” category of beers that don’t have their own category.  Wouldn&#8217;t it be nice to have some guidelines to help you brew all those styles that haven&#8217;t made it into the official BJCP Style Guide?</p>
<p>There are well over 20 styles that are of major interest to the home and micro-brewer that I think need to be honored with a style guideline.  So, recently I started researching and posting about several of these &#8220;missing&#8221; styles on my own blog, &#8220;<a href="http://www.gregroe.com/category/the-missing-styles-series/">Food, Beer &amp; Buffoonery</a>&#8221; .  I started with two varieties of German Altbier that are different enough from the standard Alt to deserve mention: <a href="http://www.gregroe.com/2008/04/10/the-missing-bjcp-styles-part-1-the-other-alts/">Sticke Ale and Münster Alt</a>.</p>
<p>I&#8217;ll be periodically adding more posts about other non-BJCP beer styles that are of interest to us brewers.  I&#8217;ll also be continually updating previous style posts as new information comes in.  With all of these, I&#8217;ll be &#8220;attempting&#8221; (with <em>big</em> help from many of you) to create a BJCP-like style description for each of these, so that we can eventually include these &#8220;missing styles&#8221; into BrewSession. Then, when you have the guidelines at your fingertips, you&#8217;ll be able to accurately brew that Sticke Alt, that Australian Sparkling Ale, that Leipziger Gose, that Classic American Cream Ale &#8230;</p>
<p><span style="font-size: 80%;">Upcoming styles in the series will include, but are not limited to: Kellerbier, Gose, Wiess, Honey Beers, Classic American Cream Ale, Czech Dark Lager, English Pale Mild, Scottish 90/-, American Stock Ale, English Strong Ale, Non-alcoholic “Beer”, Malt Liquor, Australian Sparkling Ale, Imperial/Double Red Ale, Imperial/Double Brown Ale, Imperial Lager, Imperial Pilsner, </span><span style="font-size: 80%;">Imperial Porter, Rye IPA, Dark American Wheat/Rye.</span></p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F23%2Fthe-missing-beer-styles-making-it-into-brewsession%2F&amp;title=The+Missing+Beer+Styles%2C+Making+it+into+BrewSession" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F23%2Fthe-missing-beer-styles-making-it-into-brewsession%2F&amp;title=The+Missing+Beer+Styles%2C+Making+it+into+BrewSession" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F23%2Fthe-missing-beer-styles-making-it-into-brewsession%2F&amp;title=The+Missing+Beer+Styles%2C+Making+it+into+BrewSession" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F23%2Fthe-missing-beer-styles-making-it-into-brewsession%2F&amp;title=The+Missing+Beer+Styles%2C+Making+it+into+BrewSession" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F23%2Fthe-missing-beer-styles-making-it-into-brewsession%2F&amp;title=The+Missing+Beer+Styles%2C+Making+it+into+BrewSession', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F23%2Fthe-missing-beer-styles-making-it-into-brewsession%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F23%2Fthe-missing-beer-styles-making-it-into-brewsession%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F23%2Fthe-missing-beer-styles-making-it-into-brewsession%2F&amp;title=The+Missing+Beer+Styles%2C+Making+it+into+BrewSession" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F23%2Fthe-missing-beer-styles-making-it-into-brewsession%2F&amp;title=The+Missing+Beer+Styles%2C+Making+it+into+BrewSession" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://blog.brewsession.com/2008/04/23/the-missing-beer-styles-making-it-into-brewsession/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Extending acts_as_commentable</title>
		<link>http://blog.brewsession.com/2008/04/12/extending-acts_as_commentable/</link>
		<comments>http://blog.brewsession.com/2008/04/12/extending-acts_as_commentable/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 04:48:59 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
		
		<category><![CDATA[Dean]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[acts_as_commentable]]></category>

		<category><![CDATA[acts_as_state_machine]]></category>

		<guid isPermaLink="false">http://blog.brewsession.com/?p=33</guid>
		<description><![CDATA[acts_as_commentable is a nice little ruby on rails plugin.  It extends your ActiveRecord classes giving them comments.  We are going to use comments on all kinds of things, starting with recipes, of course.  However, AAC lacks a critical feature: the ability for users to approve comments before they are displayed.  In [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/">acts_as_commentable</a> is a nice little ruby on rails plugin.  It extends your ActiveRecord classes giving them comments.  We are going to use comments on all kinds of things, starting with recipes, of course.  However, AAC lacks a critical feature: the ability for users to approve comments before they are displayed.  In this post I am going to run through extending AAC using <a href="http://rubyi.st/aasm.html">acts_as_state_machine</a>.</p>
<p>The first thing I did (and do to all the plugins we use) was <a href="http://piston.rubyforge.org/">pistonize</a> the plugin so I could hack on it without fear of getting my changes destroyed.</p>
<p>I start off simply here by adding two states to the Comment model: :pending and :approved.</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">class</span> Comment &lt; <span class="re2">ActiveRecord::Base</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1"># The first element of this array is the initial state</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; VALID_STATES = <span class="br0">&#91;</span> <span class="re3">:pending</span>, <span class="re3">:approved</span> <span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; acts_as_state_machine <span class="re3">:initial</span> =&gt; VALID_STATES<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; event <span class="re3">:approve</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; transitions <span class="re3">:from</span> =&gt; <span class="re3">:pending</span>, <span class="re3">:to</span> =&gt; <span class="re3">:approved</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; VALID_STATES.<span class="me1">each</span> <span class="kw1">do</span> |_state|</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1"># Define _state as a state</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; state _state</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="co1"># More code snipped</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>Now we are going to write some real code, so here comes a little <a href="http://rspec.info/">RSpec</a>.   aac provides three class methods:</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">class</span> Comment &lt; <span class="re2">ActiveRecord::Base</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">class</span> &lt;&lt; <span class="kw2">self</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1"># Helper class method to lookup all comments assigned</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1"># to all commentable types for a given user.</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">def</span> find_comments_by_user<span class="br0">&#40;</span>user<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1"># Helper class method to look up all comments for</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1"># commentable class name and commentable id.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">def</span> find_comments_for_commentable<span class="br0">&#40;</span>commentable_str, commentable_id<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1"># Helper class method to look up a commentable object</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1"># given the commentable class name and id</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">def</span> find_commentable<span class="br0">&#40;</span>commentable_str, commentable_id<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>Since it didn&#8217;t come with Test::Unit or RSpec tests I wrote up some test for these methods.</p>
</pre>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1">describe Comment, <span class="st0">&quot;class methods&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; fixtures <span class="re3">:comments</span>, <span class="re3">:recipes</span>, <span class="re3">:users</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should find comments by user&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Comment.<span class="me1">find_comments_by_user</span><span class="br0">&#40;</span> comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">user</span> <span class="br0">&#41;</span>.<span class="me1">should</span> all_belong_to<span class="br0">&#40;</span> comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">user</span> <span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1"># This could be more specific</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should find comments for a particular class&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Comment.<span class="me1">find_comments_for_commentable</span><span class="br0">&#40;</span> Comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">commentable_type</span>, comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">commentable_id</span> <span class="br0">&#41;</span>.<span class="me1">should</span> be_an_instance_of<span class="br0">&#40;</span><span class="kw3">Array</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should find all comments for a particular class&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1"># I happen to know that comment_one is a recipe comment</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Comment.<span class="me1">find_commentable</span><span class="br0">&#40;</span> <span class="st0">&quot;Recipe&quot;</span>, comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">commentable_id</span> <span class="br0">&#41;</span>.<span class="me1">should</span> be_an_instance_of<span class="br0">&#40;</span>Recipe<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>If you are confused by <em>should all_belong_to</em> then you should check out my <a href="http://blog.brewsession.com/2008/04/09/all_belong_to-rspec-matcher/">previous post</a>. With these specs out of the way we can go on to adding more new code.</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp;it <span class="st0">&quot;should find approved comments by user&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Comment.<span class="me1">find_approved_comments_by_user</span><span class="br0">&#40;</span> comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">user</span> <span class="br0">&#41;</span>.<span class="me1">should</span> all_be_in_state<span class="br0">&#40;</span><span class="st0">&quot;approved&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; it <span class="st0">&quot;should find pending comments by user&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Comment.<span class="me1">find_pending_comments_by_user</span><span class="br0">&#40;</span> comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">user</span> <span class="br0">&#41;</span>.<span class="me1">should</span> all_be_in_state<span class="br0">&#40;</span><span class="st0">&quot;pending&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>Now, normally you would write one spec at a time, but I think I would bore my readers, so I combined these two.  Also take note that I am using another custom RSpec matcher <em>all_be_in_state()</em>.  It looks a lot like <em>all_belong_to()</em>, so I leave its implementation as an exercise to the reader (unless I can get another blog post out of it). To get these tests to pass I add a few lines of code:</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp;VALID_STATES.<span class="me1">each</span> <span class="kw1">do</span> |_state|</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1"># Define _state as a state</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; state _state</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="co1"># Add Comment.find__comments methods</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#40;</span> <span class="kw1">class</span> &lt;&lt; <span class="kw2">self</span>; <span class="kw2">self</span>; <span class="kw1">end</span> <span class="br0">&#41;</span>.<span class="me1">instance_eval</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; define_method <span class="st0">&quot;find_#{_state}_comments_by_user&quot;</span> <span class="kw1">do</span> |_user|</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; find_in_state<span class="br0">&#40;</span> <span class="re3">:all</span>, _state, <span class="re3">:conditions</span> =&gt; <span class="br0">&#91;</span><span class="st0">&quot;user_id = ?&quot;</span>, _user.<span class="me1">id</span><span class="br0">&#93;</span>, <span class="re3">:order</span> =&gt; <span class="st0">&quot;created_at DESC&quot;</span> <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>I am not a <em>method_missing</em> kind of guy, and prefer the dynamic-method metaprogramming style.  This lot of code defines class methods at runtime that find Comments in specific states.  I am actually using <a href="http://whytheluckystiff.net/articles/seeingMetaclassesClearly.html">whytheluckystiff&#8217;s metaid</a> to hide some of the meta-junk, but I thought I should spell it out here for clarity.</p>
<p>Well, now we have a Comment class with two states and code to limit finds to cmments in a specific state.  Right now, that is all I have.  Here is the full code for the Comment class and the RSpec.  You will see another custom RSpec matcher here, <a href="http://tuples.us/2007/10/23/if-you-arent-writing-matchers-you-arent-using-rspec/"><em>require_a()</em></a>.</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">class</span> Comment &lt; <span class="re2">ActiveRecord::Base</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1"># The first element of this array is the initial state</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; VALID_STATES = <span class="br0">&#91;</span> <span class="re3">:pending</span>, <span class="re3">:approved</span> <span class="br0">&#93;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; acts_as_state_machine <span class="re3">:initial</span> =&gt; VALID_STATES<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; belongs_to <span class="re3">:commentable</span>, <span class="re3">:polymorphic</span> =&gt; <span class="kw2">true</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; belongs_to <span class="re3">:user</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; event <span class="re3">:approve</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; transitions <span class="re3">:from</span> =&gt; <span class="re3">:pending</span>, <span class="re3">:to</span> =&gt; <span class="re3">:approved</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; validates_associated <span class="re3">:user</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; validates_presence_of <span class="re3">:comment</span>, <span class="re3">:commentable_id</span>, <span class="re3">:commentable_type</span>, <span class="re3">:state</span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re3">:user_id</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; VALID_STATES.<span class="me1">each</span> <span class="kw1">do</span> |_state|</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1"># Define _state as a state</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; state _state</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1"># Add Comment.find_&lt;state&gt;_comments methods</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; meta_def <span class="st0">&quot;find_#{_state}_comments_by_user&quot;</span> <span class="kw1">do</span> |_user|</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; find_in_state<span class="br0">&#40;</span> <span class="re3">:all</span>, _state, <span class="re3">:conditions</span> =&gt; <span class="br0">&#91;</span><span class="st0">&quot;user_id = ?&quot;</span>, _user.<span class="me1">id</span><span class="br0">&#93;</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="re3">:order</span> =&gt; <span class="st0">&quot;created_at DESC&quot;</span> <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">class</span> &lt; &lt; <span class="kw2">self</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1"># Helper class method to look up a commentable object</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1"># given the commentable class name and id</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">def</span> find_commentable<span class="br0">&#40;</span>commentable_str, commentable_id<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; commentable_str.<span class="me1">constantize</span>.<span class="me1">find</span><span class="br0">&#40;</span>commentable_id<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1"># This could be refactored into find_&lt;state&gt;_comments_by_user (somehow)</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">def</span> find_comments_by_user<span class="br0">&#40;</span>_user<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; find<span class="br0">&#40;</span> <span class="re3">:all</span>, <span class="re3">:conditions</span> =&gt; <span class="br0">&#91;</span><span class="st0">&quot;user_id = ?&quot;</span>, _user.<span class="me1">id</span><span class="br0">&#93;</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re3">:order</span> =&gt; <span class="st0">&quot;created_at DESC&quot;</span> <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1"># Helper class method to look up all comments for</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1"># commentable class name and commentable id.</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">def</span> find_comments_for_commentable<span class="br0">&#40;</span>commentable_str, commentable_id<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; find<span class="br0">&#40;</span> <span class="re3">:all</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re3">:conditions</span> =&gt; <span class="br0">&#91;</span> <span class="st0">&quot;commentable_type = ? and commentable_id = ?&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;commentable_str, commentable_id <span class="br0">&#93;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re3">:order</span> =&gt; <span class="st0">&quot;created_at DESC&quot;</span> <span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">end&lt;/state&gt;</div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw3">require</span> <span class="kw4">File</span>.<span class="me1">dirname</span><span class="br0">&#40;</span><span class="kw2">__FILE__</span><span class="br0">&#41;</span> + <span class="st0">&#8216;/../../../../spec/spec_helper&#8217;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">module</span> CommentSpecHelper</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">describe Comment <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; fixtures <span class="re3">:comments</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">include</span> CommentSpecHelper</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; before<span class="br0">&#40;</span><span class="re3">:each</span><span class="br0">&#41;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="re1">@comment</span> = Comment.<span class="me1">new</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should start out in pending state&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="re1">@comment</span>.<span class="me1">state</span>.<span class="me1">should</span> == <span class="st0">&quot;pending&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;sould transition to approved&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="re1">@comment</span> = comments<span class="br0">&#40;</span><span class="re3">:pending_comment</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="re1">@comment</span>.<span class="me1">approve</span>!</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="re1">@comment</span>.<span class="me1">state</span>.<span class="me1">should</span> == <span class="st0">&quot;approved&quot;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should require a comment&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="re1">@comment</span>.<span class="me1">should</span> require_a<span class="br0">&#40;</span><span class="re3">:comment</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should require a commentable_id&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="re1">@comment</span>.<span class="me1">should</span> require_a<span class="br0">&#40;</span><span class="re3">:commentable_id</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; it <span class="st0">&quot;should require a commentable_type&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="re1">@comment</span>.<span class="me1">should</span> require_a<span class="br0">&#40;</span><span class="re3">:commentable_type</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should require a state&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="re1">@comment</span>.<span class="me1">should</span> require_a<span class="br0">&#40;</span><span class="re3">:state</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should require a user_id&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="re1">@comment</span>.<span class="me1">should</span> require_a<span class="br0">&#40;</span><span class="re3">:user_id</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">describe Comment, <span class="st0">&quot;class methods&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; fixtures <span class="re3">:comments</span>, <span class="re3">:recipes</span>, <span class="re3">:users</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should find all comments for a particular class&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1"># I happen to know that comment_one is a recipe comment</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; Comment.<span class="me1">find_commentable</span><span class="br0">&#40;</span> <span class="st0">&quot;Recipe&quot;</span>, comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">commentable_id</span> <span class="br0">&#41;</span>.<span class="me1">should</span> be_an_instance_of<span class="br0">&#40;</span>Recipe<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should find comments by user&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Comment.<span class="me1">find_comments_by_user</span><span class="br0">&#40;</span> comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">user</span> <span class="br0">&#41;</span>.<span class="me1">should</span> all_belong_to<span class="br0">&#40;</span> comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">user</span> <span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should find approved comments by user&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Comment.<span class="me1">find_approved_comments_by_user</span><span class="br0">&#40;</span> comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">user</span> <span class="br0">&#41;</span>.<span class="me1">should</span> all_be_in_state<span class="br0">&#40;</span><span class="st0">&quot;approved&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should find pending comments by user&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Comment.<span class="me1">find_pending_comments_by_user</span><span class="br0">&#40;</span> comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">user</span> <span class="br0">&#41;</span>.<span class="me1">should</span> all_be_in_state<span class="br0">&#40;</span><span class="st0">&quot;pending&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="co1"># This could be more specific</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; it <span class="st0">&quot;should find comments for a particular class&quot;</span> <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Comment.<span class="me1">find_comments_for_commentable</span><span class="br0">&#40;</span> comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">commentable_type</span>, comments<span class="br0">&#40;</span><span class="re3">:comment_one</span><span class="br0">&#41;</span>.<span class="me1">commentable_id</span> <span class="br0">&#41;</span>.<span class="me1">should</span> be_an_instance_of<span class="br0">&#40;</span><span class="kw3">Array</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>&#8211;Dean</p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F12%2Fextending-acts_as_commentable%2F&amp;title=Extending+acts_as_commentable" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F12%2Fextending-acts_as_commentable%2F&amp;title=Extending+acts_as_commentable" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F12%2Fextending-acts_as_commentable%2F&amp;title=Extending+acts_as_commentable" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F12%2Fextending-acts_as_commentable%2F&amp;title=Extending+acts_as_commentable" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F12%2Fextending-acts_as_commentable%2F&amp;title=Extending+acts_as_commentable', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F12%2Fextending-acts_as_commentable%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F12%2Fextending-acts_as_commentable%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F12%2Fextending-acts_as_commentable%2F&amp;title=Extending+acts_as_commentable" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F12%2Fextending-acts_as_commentable%2F&amp;title=Extending+acts_as_commentable" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://blog.brewsession.com/2008/04/12/extending-acts_as_commentable/feed/</wfw:commentRss>
		</item>
		<item>
		<title>belong_to RSpec matcher</title>
		<link>http://blog.brewsession.com/2008/04/09/all_belong_to-rspec-matcher/</link>
		<comments>http://blog.brewsession.com/2008/04/09/all_belong_to-rspec-matcher/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 00:59:49 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
		
		<category><![CDATA[Dean]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[rspec]]></category>

		<guid isPermaLink="false">http://blog.brewsession.com/2008/04/09/all_belong_to-rspec-matcher/</guid>
		<description><![CDATA[I was extending acts_as_commentable and needed a good RSpec test to check the returned objects from its finder methods belonged to the correct user.  For example, Comment.find_comments_by_user( :some_user ) should all belong_to :some_user.  I&#8217;ll be darned if that doesn&#8217;t look like a RSpec description.  Since there is no all_belong_to matcher, I wrote [...]]]></description>
			<content:encoded><![CDATA[<p>I was extending <a href="http://www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/">acts_as_commentable</a> and needed a good <a href="http://rspec.info/">RSpec</a> test to check the returned objects from its finder methods belonged to the correct user.  For example, <em>Comment.find_comments_by_user( :some_user )</em> should all belong_to <em>:some_user</em>.  I&#8217;ll be darned if that doesn&#8217;t look like a RSpec description.  Since there is no all_belong_to matcher, I wrote one.</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">module</span> ActiveRecordValidations</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">class</span> BelongTo</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">def</span> initialize<span class="br0">&#40;</span>expected<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re1">@expected</span> = expected</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">def</span> matches?<span class="br0">&#40;</span>args<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; args.<span class="me1">all</span>? <span class="kw1">do</span> |target|</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re1">@target</span> = target</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re1">@target</span>.<span class="me1">send</span><span class="br0">&#40;</span>@expected.<span class="kw1">class</span>.<span class="me1">to_s</span>.<span class="me1">downcase</span><span class="br0">&#41;</span> == <span class="re1">@expected</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">def</span> failure_message</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;expected #{@target.inspect} to all belong to #{@expected}&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">def</span> negative_failure_message</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;expected #{@target.inspect} not to all belong to #{@expected}&quot;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">def</span> belong_to<span class="br0">&#40;</span>expected<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; BelongTo.<span class="me1">new</span><span class="br0">&#40;</span> <span class="br0">&#91;</span>expected<span class="br0">&#93;</span> <span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">def</span> all_belong_to<span class="br0">&#40;</span>expected<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; BelongTo.<span class="me1">new</span><span class="br0">&#40;</span> expected <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>The <em>matches?</em> method takes an array of objects and goes through them with <em>all?</em> checking that they have a belongs_to the expected thing.  Using the example above, each comment object returned by <em>Comment.find_comments_by_user</em> would get tested if <em>comment.user== @user.</em></p>
<p>&#8211;Dean</p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F09%2Fall_belong_to-rspec-matcher%2F&amp;title=belong_to+RSpec+matcher" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F09%2Fall_belong_to-rspec-matcher%2F&amp;title=belong_to+RSpec+matcher" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F09%2Fall_belong_to-rspec-matcher%2F&amp;title=belong_to+RSpec+matcher" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F09%2Fall_belong_to-rspec-matcher%2F&amp;title=belong_to+RSpec+matcher" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F09%2Fall_belong_to-rspec-matcher%2F&amp;title=belong_to+RSpec+matcher', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F09%2Fall_belong_to-rspec-matcher%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F09%2Fall_belong_to-rspec-matcher%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F09%2Fall_belong_to-rspec-matcher%2F&amp;title=belong_to+RSpec+matcher" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F04%2F09%2Fall_belong_to-rspec-matcher%2F&amp;title=belong_to+RSpec+matcher" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://blog.brewsession.com/2008/04/09/all_belong_to-rspec-matcher/feed/</wfw:commentRss>
		</item>
		<item>
		<title>BJCP Beer Style Guidelines Updated for 2008</title>
		<link>http://blog.brewsession.com/2008/03/25/bjcp-beer-style-guidelines-updated-for-2008/</link>
		<comments>http://blog.brewsession.com/2008/03/25/bjcp-beer-style-guidelines-updated-for-2008/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 01:35:28 +0000</pubDate>
		<dc:creator>gregr</dc:creator>
		
		<category><![CDATA[Greg]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[features]]></category>

		<category><![CDATA[related]]></category>

		<category><![CDATA[Beer Styles]]></category>

		<category><![CDATA[BJCP]]></category>

		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://blog.brewsession.com/2008/03/25/bjcp-beer-style-guidelines-updated-for-2008/</guid>
		<description><![CDATA[Last month the Beer Judges Certification Program (BJCP) released a minor update to their 2004 Style Guidelines. The new &#8220;2008 update to the 2004 style guidelines&#8221; (as it is officially called) includes some updated style parameters, changes to style descriptions, revised commericial examples for most beer styles and some significant rework to many Belgian ale [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Last month the <a href="http://www.bjcp.org/index.php">Beer Judges Certification Program (BJCP)</a> released a minor update to their 2004 <a href="http://www.bjcp.org/stylecenter.html">Style Guidelines</a>. The new &#8220;2008 update to the 2004 style guidelines&#8221; (as it is officially called) includes some updated style parameters, changes to style descriptions, revised commericial examples for most beer styles and some significant rework to many Belgian ale styles.</p>
<p style="text-align: justify;">In BrewSession we&#8217;re using the XML format of the BJCP style guidelines.  So as soon as I saw that the 2008 updates had been released, I wanted to make sure we got those into BrewSession as soon as possible.  I contacted the BJCP and found that no one was working on updating the <a href="http://www.bjcp.org/styles04/xml/">BJCP XML</a>.  I attempted to contact the original author of the BJCP XML without success (Chris, if you&#8217;re out there, give us a hollar, I have some questions).  So, I volunteered to update the BJCP XML to the 2008 version.</p>
<p style="text-align: justify;">The BJCP describes it as a minor update, and while there aren&#8217;t any new beer styles in the 2008 update, or high level category changes, the number of revisions made to the &#8220;fine print&#8221; are fairly numerous. While tedious, comparing the 2008 styles with the 2004 XML and making the needed changes is quite interesting, as I&#8217;m getting to know the styles like I never did before. In fact, I started <a href="http://www.gregroe.com/2008/03/03/what-is-that-doing-in-my-fridge/">going through the styles on my own</a>, buying 2-3 representatives of each style, taking some sips, and reflecting on the style guidelines.  My own BJCP course!  Dean&#8217;s already a certified BJCP judge, but I&#8217;m not.  However, I think at the end of this I&#8217;ll be prepared to take the exam.</p>
<p style="text-align: justify;">In addition to updating the text of the styles, I&#8217;m recommending that some elements of the XML be changed, enhanced and updated to make the BJCP Styles XML document more useful to a wider range of people and applications. I&#8217;ll be posting my proposals here shortly&#8230;</p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F25%2Fbjcp-beer-style-guidelines-updated-for-2008%2F&amp;title=BJCP+Beer+Style+Guidelines+Updated+for+2008" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F25%2Fbjcp-beer-style-guidelines-updated-for-2008%2F&amp;title=BJCP+Beer+Style+Guidelines+Updated+for+2008" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F25%2Fbjcp-beer-style-guidelines-updated-for-2008%2F&amp;title=BJCP+Beer+Style+Guidelines+Updated+for+2008" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F25%2Fbjcp-beer-style-guidelines-updated-for-2008%2F&amp;title=BJCP+Beer+Style+Guidelines+Updated+for+2008" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F25%2Fbjcp-beer-style-guidelines-updated-for-2008%2F&amp;title=BJCP+Beer+Style+Guidelines+Updated+for+2008', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F25%2Fbjcp-beer-style-guidelines-updated-for-2008%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F25%2Fbjcp-beer-style-guidelines-updated-for-2008%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F25%2Fbjcp-beer-style-guidelines-updated-for-2008%2F&amp;title=BJCP+Beer+Style+Guidelines+Updated+for+2008" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F25%2Fbjcp-beer-style-guidelines-updated-for-2008%2F&amp;title=BJCP+Beer+Style+Guidelines+Updated+for+2008" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://blog.brewsession.com/2008/03/25/bjcp-beer-style-guidelines-updated-for-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Kilogram is getting lighter</title>
		<link>http://blog.brewsession.com/2008/03/18/kilogram-is-getting-lighter/</link>
		<comments>http://blog.brewsession.com/2008/03/18/kilogram-is-getting-lighter/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 07:21:17 +0000</pubDate>
		<dc:creator>gregr</dc:creator>
		
		<category><![CDATA[Greg]]></category>

		<category><![CDATA[related]]></category>

		<guid isPermaLink="false">http://blog.brewsession.com/2008/03/18/kilogram-is-getting-lighter/</guid>
		<description><![CDATA[So you&#8217;re weighing out your ingredients.  Perhaps you&#8217;re not in the US &#8230; or maybe you are in the US and have a degree in science &#8230; whichever, you may be weighing out your grains using the metric system.  While the root unit of mass is the gram, the metric system of mass [...]]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;re weighing out your ingredients.  Perhaps you&#8217;re not in the US &#8230; or maybe you are in the US and have a degree in science &#8230; whichever, you may be weighing out your grains using the metric system.  While the root unit of mass is the gram, the metric system of mass is calibrated to a known weight of 1 kilogram.  More specifically to the weight of &#8220;<a href="http://physics.nist.gov/cuu/Images/kilogram.jpeg" target="_blank">a cylinder of platinum-iridium</a> kept in a vault near Paris since 1889.&#8221;</p>
<p>The problem is, the kilogram is getting lighter&#8230;  Discover magazine online published <a href="http://discovermagazine.com/2008/feb/a-kilogram-just-ain.t-what-it-used-to-be">a recent article</a> on this that I thought I&#8217;d share here.  No, it doesn&#8217;t mean much for BrewSession.  As long as we stick with the conversion of  1kg = 2.204622622 US pounds, I think we&#8217;ll be okay.  <img src='http://blog.brewsession.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  If you <a href="http://discovermagazine.com/2008/feb/a-kilogram-just-ain.t-what-it-used-to-be">read the article</a>, you&#8217;ll find that the kg has only lessened in mass by about the weight of a grain of salt since 1889.  Interesting nonetheless.</p>
<p>On another note, I&#8217;ve got 8 or so calculators ready to go&#8230;apart from the toggles having a slight issue that I&#8217;m working out.   As soon as I&#8217;m finished there, we&#8217;ll be releasing them to beta testers. (I know, I know&#8230;we keep saying that&#8230;but honestly, they&#8217;re actually working!!!, I just need to get a few minor bugs ironed out before the beta release (we&#8217;re not getting paid for this, you know ;-)&#8230;.and Dean&#8217;s been hounding me to get the design of the recipe formulation screen closer to final draft form as he has a generic Ruby on Rails + Ajax version almost ready to be styled up and and used.  And I&#8217;m holding him back.  Hmpf.)</p>
<p>I&#8217;ve also been looking into solutions for making BrewSession a desktop application as well as a web application.  Most recently I&#8217;ve been really getting into Adobe&#8217;s AIR technology &#8212; going so far as to getting a calculator or two running as desktop apps using AIR technology.  It&#8217;s really quite nice.  The only catch is, you have to have the AIR runtime on your system in order for them to work (similar to having the Java runtime installed to run Java applications).  But, AIR is a fairly small, painless download and install.  Once you have it, each AIR application installs and runs with ease (though I think it&#8217;ll require some custom CSS to make BrewSession look really spiffy on the desktop).  I wonder though&#8230;.what does the general public, the home brewer, think of having to download the AIR runtime in order to run BrewSession?    I suppose we need to get a poll going&#8230;  Feel free to post some opinions&#8230;</p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F18%2Fkilogram-is-getting-lighter%2F&amp;title=The+Kilogram+is+getting+lighter" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F18%2Fkilogram-is-getting-lighter%2F&amp;title=The+Kilogram+is+getting+lighter" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F18%2Fkilogram-is-getting-lighter%2F&amp;title=The+Kilogram+is+getting+lighter" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F18%2Fkilogram-is-getting-lighter%2F&amp;title=The+Kilogram+is+getting+lighter" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F18%2Fkilogram-is-getting-lighter%2F&amp;title=The+Kilogram+is+getting+lighter', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F18%2Fkilogram-is-getting-lighter%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F18%2Fkilogram-is-getting-lighter%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F18%2Fkilogram-is-getting-lighter%2F&amp;title=The+Kilogram+is+getting+lighter" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F03%2F18%2Fkilogram-is-getting-lighter%2F&amp;title=The+Kilogram+is+getting+lighter" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://blog.brewsession.com/2008/03/18/kilogram-is-getting-lighter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Concise Signup &#038; Signin Pages</title>
		<link>http://blog.brewsession.com/2008/02/04/concise-signup-signin-pages/</link>
		<comments>http://blog.brewsession.com/2008/02/04/concise-signup-signin-pages/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 18:16:46 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
		
		<category><![CDATA[Dean]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[design]]></category>

		<guid isPermaLink="false">http://blog.brewsession.com/2008/02/04/concise-signup-signin-pages/</guid>
		<description><![CDATA[Login, Signup
We are presented with these quick forms all the time.  While it is easy to create standard login and signup pages, Amazon.com has a good one:

What makes it good?
First of all, the prompts are written in plain English.  Amazon sells to a wide slice of the population, meaning that about 15% of [...]]]></description>
			<content:encoded><![CDATA[<h2>Login, Signup</h2>
<p>We are presented with these quick forms all the time.  While it is easy to create standard login and signup pages, Amazon.com has a good one:</p>
<blockquote><p><a href="https://www.amazon.com/gp/sign-in.html"><img src="http://blog.brewsession.com/wp-content/uploads/2008/02/amazon_signin1.png" alt="Amazon Sigin Image" /></a></p></blockquote>
<h2>What makes it good?</h2>
<p>First of all, the prompts are written in plain English.  Amazon sells to a wide slice of the population, meaning that about 15% of their customers are probably not very technology-saavy. (-2?)  Anything they can do to ease the operation helps their customers buy.</p>
<p>Secondly, when a user visits Amazon.com, there is only one link: &#8220;Your account&#8221; instead of separate login and signup links.  Simple is generally better.</p>
<p>Also note the standard &#8220;forgot your password&#8221; link plus an additional &#8220;has your email address changed?&#8221; question. Both are useful to have close at hand.</p>
<h2>Implementation</h2>
<p>Rails 2.0 strongly encourages you to design RESTful applications.  Login forms are associated with Session objects, while signup forms go with User objects (rather, Brewer objects in our case).  A simple redirect in the SessionsController#create method takes care of pointing a user in the right direction.</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">class</span> SessionsController &lt; ApplicationController</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">def</span> create</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> params<span class="br0">&#91;</span><span class="re3">:signin_action</span><span class="br0">&#93;</span> == <span class="st0">&#8216;new_user&#8217;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; redirect_to new_brewer_path<span class="br0">&#40;</span> <span class="re3">:brewer</span> =&gt; <span class="br0">&#123;</span>:email =&gt; params<span class="br0">&#91;</span><span class="re3">:email</span><span class="br0">&#93;</span><span class="br0">&#125;</span> <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1"># Do sigin stuff</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>Note that we pass params[:email] to the new_brewer_path so that field is automatically populated on the next page. If you are using the generated scaffold, you will have to change your BrewersController#new method to instantiate a new @brewer object:</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">class</span> BrewersController &lt; ApplicationController</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">def</span> new</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="re1">@brewer</span> = Brewer.<span class="me1">new</span><span class="br0">&#40;</span>params<span class="br0">&#91;</span><span class="re3">:brewer</span><span class="br0">&#93;</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>Lastly, here is the extra test:</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">class</span> SessionsControllerTest &lt; <span class="re2">Test::Unit::TestCase</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">def</span> test_should_redirect_to_new_brewer_if_asked</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; an_email = <span class="st0">&quot;dean@brewsession.com&quot;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; post <span class="re3">:create</span>, <span class="re3">:email</span> =&gt; an_email, <span class="re3">:signin_action</span> =&gt; <span class="st0">&#8216;new_user&#8217;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assert_redirected_to new_brewer_path<span class="br0">&#40;</span><span class="re3">:brewer</span> =&gt; <span class="br0">&#123;</span>:email =&gt; an_email<span class="br0">&#125;</span> <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assert_nil session<span class="br0">&#91;</span><span class="re3">:brewer_id</span><span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>In a later post I will talk about how to implement the change password action in a RESTful way.</p>
<p>&#8211;Dean</p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F02%2F04%2Fconcise-signup-signin-pages%2F&amp;title=Concise+Signup+%26%23038%3B+Signin+Pages" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F02%2F04%2Fconcise-signup-signin-pages%2F&amp;title=Concise+Signup+%26%23038%3B+Signin+Pages" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F02%2F04%2Fconcise-signup-signin-pages%2F&amp;title=Concise+Signup+%26%23038%3B+Signin+Pages" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F02%2F04%2Fconcise-signup-signin-pages%2F&amp;title=Concise+Signup+%26%23038%3B+Signin+Pages" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F02%2F04%2Fconcise-signup-signin-pages%2F&amp;title=Concise+Signup+%26%23038%3B+Signin+Pages', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.brewsession.com%2F2008%2F02%2F04%2Fconcise-signup-signin-pages%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fblog.brewsession.com%2F2008%2F02%2F04%2Fconcise-signup-signin-pages%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.brewsession.com%2F2008%2F02%2F04%2Fconcise-signup-signin-pages%2F&amp;title=Concise+Signup+%26%23038%3B+Signin+Pages" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F02%2F04%2Fconcise-signup-signin-pages%2F&amp;title=Concise+Signup+%26%23038%3B+Signin+Pages" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://blog.brewsession.com/2008/02/04/concise-signup-signin-pages/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dean Moves</title>
		<link>http://blog.brewsession.com/2008/01/14/dean-moves/</link>
		<comments>http://blog.brewsession.com/2008/01/14/dean-moves/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 19:58:34 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
		
		<category><![CDATA[Dean]]></category>

		<guid isPermaLink="false">http://blog.brewsession.com/2008/01/14/dean-moves/</guid>
		<description><![CDATA[My wife got an offer to do her Forensic Entomology PhD at Texas A&#38;M university.  It is her dream job to teach and do Forensics work, and since I work from anywhere we packed up and moved to Bryan.
We arrived a week ago, signed a lease, dropped off the dogs and cats and headed [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.facebook.com/people/Adrienne_Brundage/591300463">My wife</a> got an offer to do her Forensic Entomology PhD at <a href="http://tamu.edu">Texas A&amp;M</a> university.  It is her dream job to teach and do Forensics work, and since I work from anywhere we packed up and moved to <a href="http://en.wikipedia.org/wiki/Bryan%2C_tx" title="Bryan, TX">Bryan</a>.</p>
<p>We arrived a week ago, signed a lease, dropped off the dogs and cats and headed to <a href="http://www.obannonstaphouse.com/">O&#8217;Bannon&#8217;s</a>, a decent bar that we found during our October visit.  It&#8217;s nice to be in a place where I can easily get <a href="http://www.dogfish.com/">Dogfish Head</a> IPA, but this place does not have the beer diversity of the SF Bay Area.  The change in cost of living is awesome though.</p>
<p>What does this mean for <a href="http://brewsession.com">Brewsession</a>?  Not a heck of a lot.  We have always been more of a virtual team that just happened to get together for beer a few times a month.  Further, since I have no friends here )-: I can devote more time to coding.  I will also do some friend-finding.  Danger: the municipal golf course is practically across the street.</p>
<p>Look for a resurgence of development work.</p>
<p>&#8211;Dean</p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F01%2F14%2Fdean-moves%2F&amp;title=Dean+Moves" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F01%2F14%2Fdean-moves%2F&amp;title=Dean+Moves" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F01%2F14%2Fdean-moves%2F&amp;title=Dean+Moves" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F01%2F14%2Fdean-moves%2F&amp;title=Dean+Moves" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F01%2F14%2Fdean-moves%2F&amp;title=Dean+Moves', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.brewsession.com%2F2008%2F01%2F14%2Fdean-moves%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fblog.brewsession.com%2F2008%2F01%2F14%2Fdean-moves%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.brewsession.com%2F2008%2F01%2F14%2Fdean-moves%2F&amp;title=Dean+Moves" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2008%2F01%2F14%2Fdean-moves%2F&amp;title=Dean+Moves" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://blog.brewsession.com/2008/01/14/dean-moves/feed/</wfw:commentRss>
		</item>
		<item>
		<title>It&#8217;s oh so quiet&#8230;  Excuses, and some tidbits about Sessions</title>
		<link>http://blog.brewsession.com/2007/12/09/its-so-quiet-excuses-and-some-tidbits-about-sessions/</link>
		<comments>http://blog.brewsession.com/2007/12/09/its-so-quiet-excuses-and-some-tidbits-about-sessions/#comments</comments>
		<pubDate>Sun, 09 Dec 2007 22:35:18 +0000</pubDate>
		<dc:creator>gregr</dc:creator>
		
		<category><![CDATA[Greg]]></category>

		<category><![CDATA[features]]></category>

		<guid isPermaLink="false">http://blog.brewsession.com/2007/12/09/its-so-quiet-excuses-and-some-tidbits-about-sessions/</guid>
		<description><![CDATA[THE EXCUSES:  Yes it is quiet.  However, that doesn&#8217;t mean that nothing it happening.  Dean and I are still chugging away on things.  &#8220;Where&#8217;s the promised peek at the calculators?&#8221;, you might ask.  Well, those are really close now.   Seriously.  Problem is, we got side tracked in [...]]]></description>
			<content:encoded><![CDATA[<p><strong>THE EXCUSES:  </strong>Yes it is quiet.  However, that doesn&#8217;t mean that nothing it happening.  Dean and I are still chugging away on things.  &#8220;Where&#8217;s the promised peek at the calculators?&#8221;, you might ask.  Well, those are really close now.   Seriously.  Problem is, we got side tracked in other areas of development, along with the fact that we&#8217;ve both been really busy doing other things.</p>
<p>I know, it&#8217;s a shame.  I wish I had all the time in the world to work on BrewSession™, but as with all of us, I have other work to do that actually pays money.   Add to the fact that I just moved, Dean is about to move, I&#8217;m taking a few courses at the local college (just for the hell of it) and that spells&#8230;.&#8221;slow progress on BrewSession&#8221;.</p>
<p>That being said, it looks like I won&#8217;t be so swamped with work in the coming couple months and I&#8217;ll have more home improvement projects out of the way.  Yeah, I&#8217;m just full of excuses.  But at least I&#8217;m being optimistic.</p>
<p><strong>THE EXCITING STUFF:  </strong>I&#8217;ve been working on &#8220;Session&#8221; functionality as of late.  We&#8217;re really excited about the Session screen because it will not only allow you to track and record all the events and measurements during your BrewSession™, but also track <em>everything</em> that happens to your fermented beverage &#8212; from brew day to serving the very last pint.</p>
<p>Yup.  Track times, temps, gravities, and add notes and more for your mash, pitching the yeast, fermentation, transfers, bottling and kegging, storage, tapping and drinking those bottles.  Hey, why not tasting notes too&#8230;and why not add notes with a date stamp to track flavor changes over time.  In fact, every &#8220;event&#8221; you add will have a date/time stamp.  We&#8217;re trying to build in enormous flexibility, so if you can think of it, it&#8217;ll be possible (though I&#8217;m sure someone&#8217;s bound to stump us).  You can even set an event before it happens and have an email reminder sent to you on the day the event is set to take place &#8212; excellent for remembering to transfer.</p>
<p>You&#8217;ll also be able to get a summary of these &#8220;events&#8221;, in whole or in part.   You choose.  The ability to accurately track and record all these parameters will allow you to closely compare the same recipe made at different times, showing you which variables changed and allow you to make better guesses on causes for differences in characteristics of the resulting beers.  You&#8217;ll also be able to quickly tell how long it took you to finish off 10 gallons of that Pale Ale&#8230;</p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fblog.brewsession.com%2F2007%2F12%2F09%2Fits-so-quiet-excuses-and-some-tidbits-about-sessions%2F&amp;title=It%26%238217%3Bs+oh+so+quiet%26%238230%3B++Excuses%2C+and+some+tidbits+about+Sessions" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2007%2F12%2F09%2Fits-so-quiet-excuses-and-some-tidbits-about-sessions%2F&amp;title=It%26%238217%3Bs+oh+so+quiet%26%238230%3B++Excuses%2C+and+some+tidbits+about+Sessions" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2007%2F12%2F09%2Fits-so-quiet-excuses-and-some-tidbits-about-sessions%2F&amp;title=It%26%238217%3Bs+oh+so+quiet%26%238230%3B++Excuses%2C+and+some+tidbits+about+Sessions" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fblog.brewsession.com%2F2007%2F12%2F09%2Fits-so-quiet-excuses-and-some-tidbits-about-sessions%2F&amp;title=It%26%238217%3Bs+oh+so+quiet%26%238230%3B++Excuses%2C+and+some+tidbits+about+Sessions" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fblog.brewsession.com%2F2007%2F12%2F09%2Fits-so-quiet-excuses-and-some-tidbits-about-sessions%2F&amp;title=It%26%238217%3Bs+oh+so+quiet%26%238230%3B++Excuses%2C+and+some+tidbits+about+Sessions', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.brewsession.com%2F2007%2F12%2F09%2Fits-so-quiet-excuses-and-some-tidbits-about-sessions%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fblog.brewsession.com%2F2007%2F12%2F09%2Fits-so-quiet-excuses-and-some-tidbits-about-sessions%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fblog.brewsession.com%2F2007%2F12%2F09%2Fits-so-quiet-excuses-and-some-tidbits-about-sessions%2F&amp;title=It%26%238217%3Bs+oh+so+quiet%26%238230%3B++Excuses%2C+and+some+tidbits+about+Sessions" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.brewsession.com%2F2007%2F12%2F09%2Fits-so-quiet-excuses-and-some-tidbits-about-sessions%2F&amp;title=It%26%238217%3Bs+oh+so+quiet%26%238230%3B++Excuses%2C+and+some+tidbits+about+Sessions" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://blog.brewsession.com/2007/12/09/its-so-quiet-excuses-and-some-tidbits-about-sessions/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
