title: Doing a Http basic authentication in rails
body: <p>Hi I'm from Grails background and new to Rails. I wish to do http basic authentication in rails.</p>
  <p>I have a code in grails which does basic authentication like this:</p>
  <pre><code>def authString = &quot;${key}:&quot;.getBytes().encodeBase64().toString()
  def conn = &quot;http://something.net&quot;.toURL().openConnection()
  conn.setRequestProperty(&quot;Authorization&quot;, &quot;Basic ${authString}&quot;)
  </code></pre>
  <p>Can the same be done with rails?</p>