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

<channel>
	<title>Live &#38; Code &#187; Ruby</title>
	<atom:link href="http://www.liveandcode.com/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.liveandcode.com</link>
	<description>Enrico on programming, living, and everything in between</description>
	<lastBuildDate>Fri, 07 May 2010 13:00:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Life advice in code</title>
		<link>http://www.liveandcode.com/2009/12/21/life-advice-in-code/</link>
		<comments>http://www.liveandcode.com/2009/12/21/life-advice-in-code/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 15:53:58 +0000</pubDate>
		<dc:creator>Enrico</dc:creator>
				<category><![CDATA[Personal Development]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[life advice]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.liveandcode.com/?p=298</guid>
		<description><![CDATA[Live &#38; Code has been largely about programming and life lessons. So, you can imagine that I was incredibly delighted to see these two combined in a small exchange on Facebook started by Reginald &#8220;raganwald&#8221; Braithwaite. It&#8217;s a valuable life lesson made incredibly concise in my favourite programming language, Ruby. I leave the interpretation to [...]]]></description>
			<content:encoded><![CDATA[<p>Live &amp; Code has been largely about programming and life lessons. So, you can imagine that I was incredibly delighted to see these two combined in a small exchange on Facebook started by Reginald &#8220;raganwald&#8221; Braithwaite.</p>
<div id="attachment_299" class="wp-caption aligncenter" style="width: 490px"><img class="size-full wp-image-299  " title="Life Advice in Code (raganwald)" src="http://www.liveandcode.com/wp-content/uploads/2009/12/Life-Advice-in-Code-raganwald.png" alt="Life Advice in Code (raganwald)" width="480" height="146" /><p class="wp-caption-text">Self-esteem expressed in Ruby</p></div>
<p style="text-align: left;">It&#8217;s a valuable life lesson made incredibly concise in my favourite programming language, Ruby. I leave the interpretation to the reader. It relates to some themes that I&#8217;ve already written about before and will probably write more about in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liveandcode.com/2009/12/21/life-advice-in-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LDAP-based RBAC with ActiveLdap and declarative_authorization</title>
		<link>http://www.liveandcode.com/2009/12/14/ldap-based-rbac-with-activeldap-and-declarative_authorization/</link>
		<comments>http://www.liveandcode.com/2009/12/14/ldap-based-rbac-with-activeldap-and-declarative_authorization/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 01:40:22 +0000</pubDate>
		<dc:creator>Enrico</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[identity management]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.liveandcode.com/?p=271</guid>
		<description><![CDATA[If you followed my previous tutorial on implementing pass-through authentication to LDAP with Authlogic, you might be wondering how it can be extended to give different permissions to members of different LDAP groups. ActiveLdap and declarative_authorization make this incredibly simple. As with the first tutorial, I&#8217;ve pushed a branch based on authlogic_example that you can [...]]]></description>
			<content:encoded><![CDATA[<p>If you followed my <a title="LDAP Pass-through Authentication with Authlogic and ActiveLdap - Live &amp; Code" href="http://www.liveandcode.com/2009/08/30/ldap-pass-through-authentication-with-authlogic-and-activeldap/">previous tutorial</a> on implementing pass-through authentication to LDAP with Authlogic, you might be wondering how it can be extended to give different permissions to members of different LDAP groups. ActiveLdap and declarative_authorization make this incredibly simple.<br />
<span id="more-271"></span></p>
<p>As with the first tutorial, I&#8217;ve pushed a <a title="enricob's authlogic_example at ldap-rbac - GitHub" href="http://github.com/enricob/authlogic_example/tree/ldap-rbac">branch</a> based on <code>authlogic_example</code> that you can use as a concrete example.</p>
<p>First, let&#8217;s bring in the <a title="stffn's declarative_authorization at master - GitHub" href="http://github.com/stffn/declarative_authorization">declarative_authorization</a> gem:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># My example code was written before GitHub decided that they don't want to</span>
<span style="color:#008000; font-style:italic;"># build gems anymore but this line should do the trick.</span>
config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;declarative_authorization&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:source</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">'http://gemcutter.org'</span></pre></div></div>

<p>Now, we need to make an ActiveLdap model class like <code>LdapUser</code> but for groups. We&#8217;ll call this <code>LdapGroup</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> LdapGroup <span style="color:#006600; font-weight:bold;">&amp;</span>lt; <span style="color:#6666ff; font-weight:bold;">ActiveLdap::Base</span>
  ldap_mapping <span style="color:#ff3333; font-weight:bold;">:dn_attribute</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;cn&quot;</span>,
    <span style="color:#ff3333; font-weight:bold;">:scope</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#ff3333; font-weight:bold;">:sub</span>,
    <span style="color:#ff3333; font-weight:bold;">:prefix</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;ou=groups,o=users&quot;</span>
&nbsp;
  has_many <span style="color:#ff3333; font-weight:bold;">:members</span>, <span style="color:#ff3333; font-weight:bold;">:class_name</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;LdapUser&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:wrap</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;member&quot;</span>,
    <span style="color:#ff3333; font-weight:bold;">:primary_key</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;dn&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:foreign_key</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;dn&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The <code>ldap_mapping</code> part is very similar to the previous one for <code>LdapUser</code>, but the <code>has_many</code> is where the real ActiveLdap magic starts!</p>
<p>We are letting ActiveLdap know that an <code>LdapGroup</code> has <code>LdapUser</code> members, which are defined in the multi-valued attribute <code>member</code>, where each of the values is the DN of an <code>LdapUser</code>. If you&#8217;re looking for a bit more detail, refer to the <a href="http://ruby-activeldap.rubyforge.org/doc/">ActiveLdap documentation</a>. Keep in mind that the code above is for the specific schema used by my example application and you may have to change it to match yours.</p>
<p>With that, we should be able to list all of our LDAP groups and find the members of any particular one in the console:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&amp;</span>gt;<span style="color:#006600; font-weight:bold;">&amp;</span>gt; LdapGroup.<span style="color:#9900CC;">all</span>.<span style="color:#9900CC;">collect</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>g<span style="color:#006600; font-weight:bold;">|</span> g.<span style="color:#9900CC;">cn</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
=<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;super_admin&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
<span style="color:#006600; font-weight:bold;">&amp;</span>gt;<span style="color:#006600; font-weight:bold;">&amp;</span>gt; LdapGroup.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;super_admin&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">members</span>.<span style="color:#9900CC;">collect</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>m<span style="color:#006600; font-weight:bold;">|</span> m.<span style="color:#9900CC;">dn</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
=<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;uid=ebianco,o=users,dc=example,dc=com&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>Now we&#8217;ll create an association between <code>LdapUser</code> and <code>LdapGroup</code> so that given a user, we can figure out which groups he/she is a member of. We&#8217;re going to tell ActiveLdap that a user&#8217;s groups are those groups in which the user&#8217;s DN appears in the group&#8217;s <code>member</code> attribute:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">belongs_to <span style="color:#ff3333; font-weight:bold;">:groups</span>, <span style="color:#ff3333; font-weight:bold;">:class_name</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;LdapGroup&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:many</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;member&quot;</span>,
  <span style="color:#ff3333; font-weight:bold;">:foreign_key</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;dn&quot;</span></pre></div></div>

<p>Let&#8217;s check our handiwork in the console:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&amp;</span>gt;<span style="color:#006600; font-weight:bold;">&amp;</span>gt; LdapUser.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;ebianco&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">groups</span>.<span style="color:#9900CC;">collect</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>g<span style="color:#006600; font-weight:bold;">|</span> g.<span style="color:#9900CC;">cn</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
=<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;super_admin&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>Now why did we go through all of this effort? declarative_authorization allows us to provide an instance method for <code>User</code>, <code>#role_symbols</code>, that returns an array of symbols representing the list of roles that the user has. With our ActiveLdap setup, mapping a user&#8217;s roles to LDAP groups becomes a one-liner:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> role_symbols
  ldap_entry.<span style="color:#9900CC;">groups</span>.<span style="color:#9900CC;">collect</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>g<span style="color:#006600; font-weight:bold;">|</span> g.<span style="color:#9900CC;">cn</span>.<span style="color:#9900CC;">to_sym</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>From here, we can define the authorization rules for our LDAP-based roles. declarative_authorization reads these from <code>config/authorization_rules.rb</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">authorization <span style="color:#9966CC; font-weight:bold;">do</span>
  role <span style="color:#ff3333; font-weight:bold;">:super_admin</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    has_permission_on <span style="color:#ff3333; font-weight:bold;">:users</span>, <span style="color:#ff3333; font-weight:bold;">:to</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#ff3333; font-weight:bold;">:manage</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  role <span style="color:#ff3333; font-weight:bold;">:guest</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    has_permission_on <span style="color:#ff3333; font-weight:bold;">:users</span>, <span style="color:#ff3333; font-weight:bold;">:to</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#ff3333; font-weight:bold;">:read</span>
    has_permission_on <span style="color:#ff3333; font-weight:bold;">:users</span>, <span style="color:#ff3333; font-weight:bold;">:to</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:create</span>, <span style="color:#ff3333; font-weight:bold;">:update</span>, <span style="color:#ff3333; font-weight:bold;">:destroy</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      if_attribute <span style="color:#ff3333; font-weight:bold;">:id</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; is <span style="color:#006600; font-weight:bold;">&#123;</span>user.<span style="color:#9900CC;">id</span><span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
privileges <span style="color:#9966CC; font-weight:bold;">do</span>
  privilege <span style="color:#ff3333; font-weight:bold;">:manage</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    includes <span style="color:#ff3333; font-weight:bold;">:create</span>, <span style="color:#ff3333; font-weight:bold;">:read</span>, <span style="color:#ff3333; font-weight:bold;">:update</span>, <span style="color:#ff3333; font-weight:bold;">:destroy</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now we can use declarative_authorization as usual. I won&#8217;t go through all the details but if you want a primer on using declarative_authorization, you can start <a title="README.rdoc at master from stffn's declarative_authorization" href="http://github.com/stffn/declarative_authorization/blob/master/README.rdoc">here</a> and browse the commits on my <code>authlogic_example</code> branch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liveandcode.com/2009/12/14/ldap-based-rbac-with-activeldap-and-declarative_authorization/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Adventures in Ruby: When Constants Aren&#8217;t</title>
		<link>http://www.liveandcode.com/2009/11/16/adventures-in-ruby-when-constants-arent/</link>
		<comments>http://www.liveandcode.com/2009/11/16/adventures-in-ruby-when-constants-arent/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 18:14:48 +0000</pubDate>
		<dc:creator>Enrico</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mystery]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.liveandcode.com/?p=249</guid>
		<description><![CDATA[I just squashed a bug that had me scratching my head for at least a good half-hour or so involving a class constant that kept on getting changed. Here&#8217;s the setup (anonymized so that I&#8217;m not exposing gooey proprietary secrets): class WebTransaction &#160; # Base URL for transaction web service SERVICE_URL = &#34;http://accountingservice.com/&#34; &#160; def [...]]]></description>
			<content:encoded><![CDATA[<p>I just squashed a bug that had me scratching my head for at least a good half-hour or so involving a class constant that kept on getting changed. Here&#8217;s the setup (anonymized so that I&#8217;m not exposing gooey proprietary secrets):</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> WebTransaction
&nbsp;
  <span style="color:#008000; font-style:italic;"># Base URL for transaction web service</span>
  SERVICE_URL = <span style="color:#996600;">&quot;http://accountingservice.com/&quot;</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> transaction_url
    url = SERVICE_URL
    url <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;VAL1=foo&quot;</span>
    url <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;&amp;VAL2=bar&quot;</span>
    url
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The class is meant to represent a transaction being posted against a rather odd web service that actually uses GET rather than POST for posting transactions (bad web service!). In my actual code, the URL parameters appended to the SERVICE_URL base would be determined on a per-object basis but I&#8217;ve simplified it here.</p>
<p>Here&#8217;s the punchline: <code>SERVICE_URL</code> was <em>changing!</em> Calls to <code>transaction_url</code> would keep on appending more variables to it. If you&#8217;re particularly clever with Ruby, you&#8217;ve already figured out exactly why. But if you&#8217;re scratching your head like I was, here are some hints:</p>
<ul>
<li>In Ruby, constants <em>aren&#8217;t</em>. In fact, they&#8217;re really no different from variables except for the fact that Ruby detects that variable names in all-caps are probably supposed to stay constant and warns if you try to assign to them.</li>
<li><code>&lt;&lt;</code>, for strings, will append to the end of the string.</li>
<li>Ruby strings are mutable. That is, operations on a string variable will usually be done in place, rather than returning a new string. (Method calls, on the other hand, are a different story!)</li>
<li>Assigning a String variable to another String variable will assign the reference. That is, the two variables will be pointing at the same object.</li>
</ul>
<p>Hit the jump to see the solution to this little mystery&#8230;<br />
<span id="more-249"></span></p>
<p><code>SERVICE_URL</code> is only directly assigned to when it is declared. But what happens when I assign <code>SERVICE_URL</code> to the local variable in <code>transaction_url</code>, <code>url</code>. <em>They&#8217;re pointing to the same object!</em></p>
<p>Then I go ahead and I start appending things to the end of the string. Ruby has no complaints because I&#8217;m not assigning to <code>SERVICE_URL</code> but <em>the object that it is pointing to is being changed!</em> The operation is causing the URL parameters to be appended in place.</p>
<p>And that, friends, is what happens when constants aren&#8217;t. Let&#8217;s fix this little error:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> WebTransaction
&nbsp;
  <span style="color:#008000; font-style:italic;"># Base URL for transaction web service</span>
  SERVICE_URL = <span style="color:#996600;">&quot;http://accountingservice.com/&quot;</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> transaction_url
    url = SERVICE_URL.<span style="color:#9900CC;">clone</span>
    url <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;VAL1=foo&quot;</span>
    url <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;&amp;VAL2=bar&quot;</span>
    url
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now, instead of appending to the string object referenced by <code>SERVICE_URL</code> directly, I&#8217;m creating a copy of the object and then appending URL parameters to that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liveandcode.com/2009/11/16/adventures-in-ruby-when-constants-arent/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>LDAP Pass-through Authentication with Authlogic and ActiveLdap</title>
		<link>http://www.liveandcode.com/2009/08/30/ldap-pass-through-authentication-with-authlogic-and-activeldap/</link>
		<comments>http://www.liveandcode.com/2009/08/30/ldap-pass-through-authentication-with-authlogic-and-activeldap/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 17:57:47 +0000</pubDate>
		<dc:creator>Enrico</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[authlogic]]></category>
		<category><![CDATA[identity management]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.liveandcode.com/?p=195</guid>
		<description><![CDATA[Today, I pushed a branch to my fork of authlogic_example: with-activeldap. This branch shows a way of implementing pass-through authentication to an LDAP server using ActiveLdap and Authlogic, with just some small changes to the User and UserSession models. First, we&#8217;ll need to bring in the net-ldap and activeldap gems. We edit config/environment.rb to include [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I pushed a branch to my fork of <code>authlogic_example</code>: <a title="enricob's authlogic_example at with-activeldap - GitHub" href="http://github.com/enricob/authlogic_example/tree/with-activeldap"><code>with-activeldap</code></a>.</p>
<p>This branch shows a way of implementing pass-through authentication to an LDAP server using <a title="RubyForge: Ruby/ActiveLdap Project Page" href="http://rubyforge.org/projects/ruby-activeldap/">ActiveLdap</a> and <a title="binarylogic's authlogic at master - GitHub" href="http://github.com/binarylogic/authlogic">Authlogic</a>, with just some small changes to the <code>User</code> and <code>UserSession</code> models.</p>
<p><span id="more-195"></span><br />
First, we&#8217;ll need to bring in the <code>net-ldap</code> and <code>activeldap</code> gems. We edit <code>config/environment.rb</code> to include the following two lines:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;net-ldap&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'&gt;=0.0.5'</span>
config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;activeldap&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;active_ldap&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'1.0.9'</span></pre></div></div>

<p>If you use <code>sudo gem install net-ldap</code>, you&#8217;ll get 0.0.4. Here, I&#8217;ve built the 0.0.5 gem from the <a title="innovationfactory's ruby-net-ldap at master - GitHub" href="http://github.com/innovationfactory/ruby-net-ldap/">GitHub repo</a>. This is because there are some bug fixes in the GitHub master that aren&#8217;t in the RubyForge gem. In the <code>with-activeldap</code> branch, the two gems are vendored.</p>
<p>Now, we create config/ldap.yml to configure ActiveLdap&#8217;s connection to our LDAP server. Here&#8217;s mine:</p>

<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">development:
  host: 127.0.0.1
  base: dc=dev,dc=Asuka,dc=local
  bind_dn: cn=Manager,dc=dev,dc=Asuka,dc=local
  password: secret
&nbsp;
test:
  host: 127.0.0.1
  base: dc=test,dc=Asuka,dc=local
  bind_dn: cn=Manager,dc=Asuka,dc=local
  password: secret
&nbsp;
production:
  host: 127.0.0.1
  base: dc=prod,dc=Asuka,dc=local
  bind_dn: cn=Manager,dc=Asuka,dc=local
  password: secret</pre></div></div>

<p>This tells ActiveLdap the server/port to connect to, what the base entry for our LDAP objects is, and what user to bind as for operations on the server. Now, we create a <code>LdapUser</code> class to represent user entries in the LDAP:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> LdapUser <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveLdap::Base</span>
  ldap_mapping <span style="color:#ff3333; font-weight:bold;">:dn_attribute</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;uid&quot;</span>,
    <span style="color:#ff3333; font-weight:bold;">:scope</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:sub</span>,
    <span style="color:#ff3333; font-weight:bold;">:prefix</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;o=users&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>This defines an LDAP user as being an entry from the <code>o=users</code> organization, where all of the entries are distinguished by the <code>uid</code> attribute. Now, we should be able to use the console to list all of our LDAP users like so:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"> <span style="color:#006600; font-weight:bold;">&gt;&gt;</span> LdapUser.<span style="color:#9900CC;">all</span></pre></div></div>

<p>Now, we&#8217;ll add some methods to the <code>User</code> model that allow us to look up users by login in the LDAP and create entries in the database if they don&#8217;t already exist. We&#8217;ll also need a method for forwarding the credentials provided on the login form to the LDAP and see if they are valid:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> User <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  acts_as_authentic <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>c<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#008000; font-style:italic;"># Don't validate password, since that will be held in the LDAP</span>
    c.<span style="color:#9900CC;">validate_password_field</span> = <span style="color:#0000FF; font-weight:bold;">false</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> ldap_entry
    LdapUser.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">login</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Tries to find a User first by looking into the database and then by</span>
  <span style="color:#008000; font-style:italic;"># creating a User if there's an LDAP entry for the given login</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">find_or_create_from_ldap</span><span style="color:#006600; font-weight:bold;">&#40;</span>login<span style="color:#006600; font-weight:bold;">&#41;</span>
    find_by_login<span style="color:#006600; font-weight:bold;">&#40;</span>login<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">||</span> create_from_ldap_if_valid<span style="color:#006600; font-weight:bold;">&#40;</span>login<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Creates a User record in the database if there is an entry in the LDAP</span>
  <span style="color:#008000; font-style:italic;"># with the given login</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">create_from_ldap_if_valid</span><span style="color:#006600; font-weight:bold;">&#40;</span>login<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">begin</span>
      User.<span style="color:#9900CC;">create</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:login</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> login<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> LdapUser.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span>login<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#6666ff; font-weight:bold;">ActiveLdap::EntryNotFound</span>
      <span style="color:#0000FF; font-weight:bold;">nil</span> <span style="color:#008000; font-style:italic;"># Don't do anything since we can't find an entry</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  protected
    <span style="color:#008000; font-style:italic;"># Authenticates the user against the LDAP.</span>
    <span style="color:#9966CC; font-weight:bold;">def</span> valid_ldap_credentials?<span style="color:#006600; font-weight:bold;">&#40;</span>password_plaintext<span style="color:#006600; font-weight:bold;">&#41;</span>
      ldap_entry.<span style="color:#9900CC;">bind</span><span style="color:#006600; font-weight:bold;">&#40;</span>password_plaintext<span style="color:#006600; font-weight:bold;">&#41;</span>
      ldap_entry.<span style="color:#9900CC;">remove_connection</span>
      <span style="color:#0000FF; font-weight:bold;">true</span>
    <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#6666ff; font-weight:bold;">ActiveLdap::AuthenticationError</span>, <span style="color:#6666ff; font-weight:bold;">ActiveLdap::LdapError::UnwillingToPerform</span>
      <span style="color:#0000FF; font-weight:bold;">false</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>With this, there is no longer a need for the <code>crypted_password</code> and <code>password_salt</code> columns in the <code>users</code> table, so if those columns exist, you&#8217;ll have to write a migration to remove them (or at least allow NULL values for them). Now, we modify the <code>UserSession</code> to use our custom methods for looking up users and validating their credentials:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> UserSession <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">Authlogic::Session::Base</span>
  find_by_login_method <span style="color:#ff3333; font-weight:bold;">:find_or_create_from_ldap</span>
  verify_password_method <span style="color:#ff3333; font-weight:bold;">:valid_ldap_credentials</span>?
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>With that, we should now be able to log in as a user by providing her <code>uid</code> as the login and the password. LDAP pass-through authentication achieved! There is a downside though: ActiveLdap is not particularly efficient with its queries but this can be mitigated by storing the user&#8217;s LDAP entry (the <code>LdapUser</code> object) in the <code>User</code> instance when it is first looked up.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> ldap_entry
  <span style="color:#0066ff; font-weight:bold;">@ldap_entry</span> <span style="color:#006600; font-weight:bold;">||</span>= LdapUser.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">login</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>In a future post, I will extend this further by modeling LDAP groups and bringing in declarative_authorization to implement role-based access control based on LDAP group membership.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liveandcode.com/2009/08/30/ldap-pass-through-authentication-with-authlogic-and-activeldap/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Where is why?</title>
		<link>http://www.liveandcode.com/2009/08/19/where-is-why/</link>
		<comments>http://www.liveandcode.com/2009/08/19/where-is-why/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 21:11:07 +0000</pubDate>
		<dc:creator>Enrico</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mystery]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.liveandcode.com/?p=185</guid>
		<description><![CDATA[&#8220;Why The Lucky Stiff&#8221;, one of the most influential characters in the Ruby community, has simply vanished. His Twitter account, GitHub account, and most of his websites are gone without a trace. Why The Lucky Stiff&#8217;s contributions to the Ruby community include &#8220;Why&#8217;s Poignant Guide to Ruby&#8221;, a book which many state was the reason [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Why The Lucky Stiff&#8221;, one of the most influential characters in the Ruby community, has simply vanished. His <a href="http://twitter.com/_why">Twitter account</a>, <a title="why's Profile - GitHub" href="http://github.com/why/">GitHub account</a>, and <a title="Discussion on Hacker News about _why's disappearance" href="http://news.ycombinator.com/item?id=773108">most of his websites</a> are gone without a trace.</p>
<p>Why The Lucky Stiff&#8217;s contributions to the Ruby community include &#8220;Why&#8217;s Poignant Guide to Ruby&#8221;, a book which many state was the reason they got into Ruby, Shoes, an easy-to-use cross-platform GUI toolkit with innovative online distribution features, and Hpricot, a very slick HTML parser that is also a joy to use.</p>
<p>Some believe that he has decided to move on from software development because his last tweet reads &#8220;programming is rather thankless. u see your works become replaced by superior ones in a year. unable to run at all in a few more.&#8221; Some believe that his accounts were all hacked. A few others believe that his anonymity has been <a title="Who is why the lucky stiff?" href="http://whoiswhytheluckystiff.wordpress.com/">compromised</a> and that he has decided the destroy the pseudonym.</p>
<p>Wherever Why The Lucky Stiff goes from here, I hope he knows that there are so many of us who looked up to him and have him to thank for knowing the joy that is programming in Ruby. He will be sorely missed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liveandcode.com/2009/08/19/where-is-why/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Rails Puzzler</title>
		<link>http://www.liveandcode.com/2009/07/29/a-rails-puzzler/</link>
		<comments>http://www.liveandcode.com/2009/07/29/a-rails-puzzler/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 18:40:27 +0000</pubDate>
		<dc:creator>Enrico</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[YARD]]></category>

		<guid isPermaLink="false">http://www.liveandcode.com/?p=166</guid>
		<description><![CDATA[While I refuse to call this &#8220;magic&#8221;, the following has been confusing me for a long time now and I&#8217;ve finally decided to post it to my blog and see if anyone else gets it. It turns out that ActiveScaffold and YARD don&#8217;t play nice together. In particular, if YARD has previously been loaded (say, [...]]]></description>
			<content:encoded><![CDATA[<p>While I refuse to call this &#8220;magic&#8221;, the following has been confusing me for a long time now and I&#8217;ve finally decided to post it to my blog and see if anyone else gets it.</p>
<p>It turns out that <a href="http://activescaffold.com/">ActiveScaffold</a> and <a href="http://yard.soen.ca/">YARD</a> don&#8217;t play nice together. In particular, if YARD has previously been loaded (say, to define a Rake task for it), ActiveScaffold initialization will fail with the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">uninitialized constant <span style="color:#6666ff; font-weight:bold;">Helpers::ControllerHelpers</span></pre></div></div>

<p>Using <code>--trace</code> and following the source code, I find out that this is happening during ActiveScaffold&#8217;s initialization, particularly at this statement:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">ActionController::Base</span>.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:include</span>, <span style="color:#6666ff; font-weight:bold;">ActiveScaffold::Helpers::ControllerHelpers</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Debugging the ActiveScaffold initialization code yields this baffling result:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveScaffold::Helpers</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> Helpers
<span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveScaffold::Helpers::ControllerHelpers</span>
<span style="color:#CC00FF; font-weight:bold;">NameError</span>: uninitialized constant <span style="color:#6666ff; font-weight:bold;">ActiveScaffold::Helpers</span></pre></div></div>

<p>It&#8217;s the weirdest thing that I&#8217;ve seen since I became a Rubyist and it is blocking me from using YARD to generate the documentation for my current Rails project. Unfortunately, cutting out ActiveScaffold isn&#8217;t going to fly because the deadline for initial release is so close and so much functionality is implemented using it already. It wasn&#8217;t my choice; if I had my way, I might never use ActiveScaffold ever again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liveandcode.com/2009/07/29/a-rails-puzzler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>On &#8220;Magical&#8221; Ruby and Rails</title>
		<link>http://www.liveandcode.com/2009/07/23/on-magical-ruby-and-rails/</link>
		<comments>http://www.liveandcode.com/2009/07/23/on-magical-ruby-and-rails/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 12:00:39 +0000</pubDate>
		<dc:creator>Enrico</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.liveandcode.com/?p=160</guid>
		<description><![CDATA[Giles Bowkett wrote a post which, at the surface, seems to be a harsh criticism of the way that Pythonistas and, in particular, Django developers view Ruby and Rails but is actually much more general — he simply wanted to point out that the entire notion of calling language/framework features “magic” is silly for programmers, [...]]]></description>
			<content:encoded><![CDATA[<p>Giles Bowkett wrote a <a title="Giles Bowkett: Do You Believe in Magic?" href="http://gilesbowkett.blogspot.com/2009/07/do-you-believe-in-magic.html">post</a> which, at the surface, seems to be a harsh criticism of the way that Pythonistas and, in particular, Django developers view Ruby and Rails but is actually much more general — he simply wanted to point out that the entire notion of calling language/framework features “magic” is silly for programmers, who should prefer to be rational than superstitious.</p>
<p><span id="more-160"></span></p>
<p>It’s the same reason why scientists have by and large stopped explaining away the world with “God”. Saying that something in our natural world is “magic” or the work of a “God” is a cop-out. Why even study the world at all? We could just say it’s all hocus-pocus and never have to worry about it! The same idea can apply to programming as well.</p>
<p>I used to think that Ruby meta-programming was dark magic. I didn’t understand any of it and felt like I just couldn’t break through the barrier of clever one-liners and idioms, but I started to read the source code of Ruby projects that I used in my day job and side projects. I studied carefully, taking the time to understand even the most complex-looking constructions. I learned some things about Ruby that I didn’t know before and picked up some common patterns. Suddenly, Ruby made a lot more sense and my skill with it grew rapidly. Every day, I’m learning more and more.</p>
<p>So here’s the first part of the message that Giles was trying to deliver: <strong>Rails is not magic. It’s <em>Ruby</em>.</strong></p>
<p>(There are also some supplementary thoughts about how, from a Lisp lover’s point of view, languages like Ruby and Python, even with all of their meta-programming power, might be annoying because there is still a subtle distinction between data and code.)</p>
<p>This is not to say that Rails is perfect or pure. The Rails team is making great efforts to bring in ideas from Merb to reduce some of the pain that developers feel when trying to go against the grain of Rails’ conventions. I am very much looking forward to Rails 3 and I think many others in the Rails developer community are too. But it is not “dark magic”; it is a tapestry of abstractions (albeit sometimes of the <a title="The Law of Leaky Abstractions - Joel On Software" href="http://www.joelonsoftware.com/articles/LeakyAbstractions.html">leaky</a> variety) that are weaved together with clever Ruby programming. Maybe some of the code is too clever for its own good but it is a potent demonstration of just how expressive Ruby can be. But the upshot of Rails’ design is that, inevitably, something in Rails won’t behave the way you might desire it to and you will find yourself forced to dive into the source code of the framework to find out why.</p>
<p>While I don’t disagree with the notion that Rails could be documented a lot better, I’ve <a href="http://twitter.com/enricobianco/status/2676399009">realized</a> that source code is the most reliable form of documentation. API docs and tutorials and blog posts may be out of date or missing details, but the source code is the current set of instructions that is being given to the computer. It is always the most comprehensive and accurate picture of how the system works at any given moment. And, more frequently than ever, we have the power to dive into the source of the software we use to enhance our understanding where its documentation fails.</p>
<p>Now here comes the second part of what Giles was trying to say:</p>
<p>If you love Ruby (as even some anti-Rails folks do) but you’re vexed by Ruby “magic”, <strong>read the source</strong>. Study it carefully, ask for help if you need to, and contribute your findings back to the community. But don’t just dismiss it as magic, or you might be missing out on a chance to learn some incredibly useful and powerful things.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liveandcode.com/2009/07/23/on-magical-ruby-and-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Future Ruby &#8211; Day 3</title>
		<link>http://www.liveandcode.com/2009/07/21/future-ruby-day-3/</link>
		<comments>http://www.liveandcode.com/2009/07/21/future-ruby-day-3/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 02:03:31 +0000</pubDate>
		<dc:creator>Enrico</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[Future Ruby]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Unspace]]></category>

		<guid isPermaLink="false">http://www.liveandcode.com/?p=158</guid>
		<description><![CDATA[Sunday, July 12th, 2009 While the previous two days had already blown my mind, it seems as though the best had been saved for last.  The day&#8217;s talks started with Collin T. Miller giving us his thoughts on how we can move away from text as the primary way of encoding computer programs and move towards [...]]]></description>
			<content:encoded><![CDATA[<h3>Sunday, July 12th, 2009</h3>
<p>While the previous two days had already blown my mind, it seems as though the best had been saved for last.  The day&#8217;s talks started with <a title="Collin T. Miller - Twitter" href="http://twitter.com/collintmiller">Collin T. Miller</a> giving us his thoughts on how we can move away from text as the primary way of encoding computer programs and move towards other encodings that more closely resemble the domains in which we are trying to solve computing problems. While I found his ideas interesting, I don&#8217;t think I can agree with his notion that text should be replaced as the primary encoding for programs. I think that text is an excellent way of representing computer programs: it is concise, easy to manipulate, and easy to parse.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liveandcode.com/2009/07/21/future-ruby-day-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FutureRuby &#8211; Days 1 &amp; 2</title>
		<link>http://www.liveandcode.com/2009/07/12/futureruby-days-1-2/</link>
		<comments>http://www.liveandcode.com/2009/07/12/futureruby-days-1-2/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 13:24:28 +0000</pubDate>
		<dc:creator>Enrico</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[Future Ruby]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Unspace]]></category>

		<guid isPermaLink="false">http://www.liveandcode.com/?p=153</guid>
		<description><![CDATA[Edit: In my haste to post my write-up of these first two days of the conference, I didn&#8217;t do much in the way of linking and I forgot to write about one of the coolest things that happened on Saturday, the flying robot blimp. Bear with me as I edit this post to add some [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Edit: </strong>In my haste to post my write-up of these first two days of the conference, I didn&#8217;t do much in the way of linking and I forgot to write about one of the coolest things that happened on Saturday, the flying robot blimp. Bear with me as I edit this post to add some much needed links and visuals.</p>
<p><strong>Friday, July 10, 2009</strong></p>
<p>After work, I walked over to the Metropolitan Hotel to get my badge. My kit included a schedule, a large poster, a crimson t-shirt with black Russian-propaganda style Future Ruby logo, a bottle of water, a pack of matches, a patch with the Future Ruby logo on it (for sewing on to backpacks and the like) and a TTC pass valid for the length of the convention. All of this was stuffed inside of a rugged, dark green bag with the Future Ruby patch sewn on it. This is by and far the <em>best</em> swag I&#8217;ve ever received at a conference, ever.</p>
<p>After that, I got dinner and headed down to Unspace HQ for a wicked awesome patio party. Unspace HQ seems like an incredible place to work &#8212; prime location, lots of outdoor space, and a pretty nice collection of knick knacks, including a working pinball machine &#8212; but it is also an excellent space for a party. The highlight of the night for me was seeing two CF18&#8242;s doing a fly-by. Although I&#8217;m not a huge fan of military hardware, watching the way that they turned through the air was a unique experience.</p>
<p>I went home early to give myself enough time to commute home and get at least 5-6 hours of sleep for the next day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liveandcode.com/2009/07/12/futureruby-days-1-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>GitHub Project Watch &#8211; 09/07/08</title>
		<link>http://www.liveandcode.com/2009/07/09/github-project-watch-090708/</link>
		<comments>http://www.liveandcode.com/2009/07/09/github-project-watch-090708/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 13:00:37 +0000</pubDate>
		<dc:creator>Enrico</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.liveandcode.com/?p=132</guid>
		<description><![CDATA[I&#8217;ve decided to create a new series of posts called &#8220;GitHub Project Watch&#8221; to highlight some of the projects on GitHub that I am watching. It&#8217;s kind of like GitHub Rebase, but with my own personal touch. Here are some of the projects that I&#8217;m watching this week: jmettraux/ruote: an open source workflow engine built [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided to create a new series of posts called &#8220;GitHub Project Watch&#8221; to highlight some of the projects on GitHub that I am watching. It&#8217;s kind of like GitHub Rebase, but with my own personal touch.</p>
<p>Here are some of the projects that I&#8217;m watching this week:</p>
<ul>
<li><a href="http://github.com/jmettraux/ruote">jmettraux/ruote</a>:<strong> </strong>an open source workflow engine built with Ruby. I might be using this for a project I&#8217;m working on. Also see <a href="http://github.com/jmettraux/ruote-web2">jmettraux/ruote-web2</a> for a demonstration of how to integrate ruote with Ruby on Rails.</li>
<li><a href="http://github.com/brynary/webrat">brynary/webrat</a>: automated acceptance testing with Ruby. It can simulate a simple browser on its own or drive a real browser via Selenium. Apparently there&#8217;s some work in progress on integrating with Watir and Celerity as well.</li>
<li><a href="http://github.com/radiant/radiant">radiant/radiant</a>:<strong> </strong>RadiantCMS, the lightweight web content management system for Ruby on Rails. I&#8217;m contributing a Japanese translation, the current version of which is currently available in the official i18n branch. (also see k<a href="http://github.com/kbingman/radiant">bingman/radiant</a><strong> </strong>and <a href="http://github.com/enricob/radiant">enricob/radiant</a>)</li>
<li><a href="http://github.com/chriseppstein/compass">chriseppstein/compass</a>:<strong> </strong>As I wrote <a title="Live &amp; Code - Compass: Still going on strong" href="http://www.liveandcode.com/2009/07/08/compass-still-going-on-strong/">previously</a>, Compass is gaining new features at an incredible rate. It now sports improved Rails integration, Blueprint 0.9, an extension system, and asset hosts support. As an added bonus, it no longer depends on edge Haml; it will work with the newest stable release of Haml, 2.2.0. This is one of the most watched repositories on GitHub for a reason &#8212; if you&#8217;re not already using this, try it today!</li>
</ul>
<p>I&#8217;m sure that I will hear of even more awesome projects at Future Ruby.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liveandcode.com/2009/07/09/github-project-watch-090708/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
