<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Adventures In Coding</title>
    <link>http://adventuresincoding.com</link>
    <description>Kevin Faustino's technical blog about Ruby, Ruby on Rails, and JavaScript</description>
    <lastBuildDate>2012-02-23 03:21:45 +0000</lastBuildDate>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AdventuresInCoding" /><feedburner:info uri="adventuresincoding" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
      <title>Speed up your websites with Smusher</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/T1NM276FtdU/speed-up-your-websites-with-smusher</link>
      <pubDate>Fri, 18 Nov 2011 13:54:06 +0000</pubDate>
      <author />
      <guid isPermaLink="false">http://adventuresincoding.com/2011/11/speed-up-your-websites-with-smusher</guid>
      <description>&lt;p&gt;Images are a bulk of the load time for many sites. There are many techniques that can allow for less requests, such as creating &lt;span class="caps"&gt;CSS&lt;/span&gt; Sprites. While I believe these techniques are essential, clients will still have to download the images in the end.&lt;/p&gt;
&lt;p&gt;Saving your images with Photoshop&amp;#8217;s &amp;#8220;Save for Web &amp;amp; Devices&amp;#8221; doesn&amp;#8217;t ensure that they are truly optimized. However, there are ways to get smaller images without quality loss.&lt;/p&gt;
&lt;h3&gt;&amp;#8220;Lossless&amp;#8221; images&lt;/h3&gt;
&lt;p&gt;Using optimization techniques, images can be optimized to smaller sizes without effecting their visual quality.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.smushit.com/ysmush.it/"&gt;Yahoo! SmushIt&lt;/a&gt; and &lt;a href="http://punypng.com"&gt;PunyPNG&lt;/a&gt; are two great services on the web that allow you to upload images and receive byte reduced versions.&lt;/p&gt;
&lt;h3&gt;Smusher&lt;/h3&gt;
&lt;p&gt;Using the above mentioned services requires manually selecting files and uploading them to the web. Thanks to Michael Grosser, we now have Smusher, a Ruby &lt;span class="caps"&gt;CLI&lt;/span&gt; for lossless reduction of your images.&lt;/p&gt;
&lt;p&gt;Smusher will take an image or directory of images and process them through an image reduction service with just a single line in your terminal.&lt;/p&gt;
&lt;p&gt;To install it, run the following:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;gem install smusher&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;By default, smusher uses &lt;a href="http://www.smushit.com/ysmush.it/"&gt;Yahoo! SmushIt&lt;/a&gt;, but also has to option to switch to the PunyPng service.&lt;/p&gt;
&lt;h3&gt;Usage&lt;/h3&gt;
&lt;p&gt;To process a directory of images, run the &lt;code&gt;smusher&lt;/code&gt; command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;% smusher public/images --service PunyPng&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;To demonstrate the savings, I ran smusher on a &lt;a href="http://upload.wikimedia.org/wikipedia/en/d/de/Ruby-%28programming-language%29-logo-2008.png"&gt;Ruby logo&lt;/a&gt; found on Wikipedia:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
smushing Ruby-(programming-language)-logo-2008.png
27416 -&amp;gt; 23544                           = 85%
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;Smusher saved us 15% on just one image. Multiply that by every image on your site, and you will have made your users a little more happy with faster page downloads.&lt;/p&gt;
&lt;h3&gt;.puny_png_api_key&lt;/h3&gt;
&lt;p&gt;If you are a PunyPNG service subscriber, you can store your api key for future usage by smusher.&lt;/p&gt;
&lt;p&gt;Add a file named &lt;strong&gt;.puny_png_api_key&lt;/strong&gt; to your home directory with your PunyPNG api key as it&amp;#8217;s contents.&lt;/p&gt;
&lt;h3&gt;Use it&lt;/h3&gt;
&lt;p&gt;Smusher is a great tool that has been available for years and I feel is not really known to most web developers. Once you start using it, I truly believe it will be a part of your utility belt.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/T1NM276FtdU" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2011/11/speed-up-your-websites-with-smusher</feedburner:origLink></item>
    <item>
      <title>Getting Inherited Resources 1.2.1 and Mongoid to play nice</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/51VmC1PD6_g/getting-inherited-resources-121-and-mongoid-to-play-nice</link>
      <pubDate>Sun, 20 Mar 2011 19:27:30 +0000</pubDate>
      <author />
      <guid isPermaLink="false">http://adventuresincoding.com/2011/03/getting-inherited-resources-121-and-mongoid-to-play-nice</guid>
      <description>&lt;p&gt;With the release of version 1.2.1 of &lt;a href="https://github.com/josevalim/inherited_resources"&gt;Inherited Resources&lt;/a&gt;, compatibility with &lt;a href="http://www.mongoid.org"&gt;Mongoid&lt;/a&gt; was broken. To optimize the setting of a collection in a controller, Inherited Resources calls the &lt;code&gt;scoped&lt;/code&gt; method at the end of the collection association chain over calling &lt;code&gt;all&lt;/code&gt;. The change to use &lt;code&gt;scoped&lt;/code&gt; results in a collection being lazily queried. The reason why Mongoid breaks is because it does not have a &lt;code&gt;scoped&lt;/code&gt; method, thus using Inherited Resources in any Mongoid project causes collection controller actions to break.&lt;/p&gt;
&lt;p&gt;Inherited Resources has rectified the issue in their &lt;em&gt;master&lt;/em&gt; branch on GitHub by checking to see if the collection responds to &lt;code&gt;scoped&lt;/code&gt;. If you cannot wait for the next release of Inherited Resources, add the following code to one of your Rails initializers to get it working with Mongoid again:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
# app/config/initializers/inherited_resources.rb

module InheritedResources
  class Base
    
    def collection
      get_collection_ivar || begin
        c = end_of_association_chain
        set_collection_ivar(c.respond_to?(:scoped) ? c.scoped : c.all)
      end
    end
    
  end
end
&lt;/code&gt;&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/51VmC1PD6_g" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2011/03/getting-inherited-resources-121-and-mongoid-to-play-nice</feedburner:origLink></item>
    <item>
      <title>Rails Templater - Agnostic at last</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/zSwRmn8c004/rails-templater---agnostic-at-last</link>
      <pubDate>Mon, 31 Jan 2011 01:26:11 +0000</pubDate>
      <author />
      <guid isPermaLink="false">http://adventuresincoding.com/2011/01/rails-templater---agnostic-at-last</guid>
      <description>&lt;h3&gt;What Rails Templater used to be&lt;/h3&gt;
&lt;p&gt;Rails Templater was originally a &lt;a href="http://adventuresincoding.com/2010/07/jumpstart-your-ruby-on-rails-3-applications-with-rails-templater"&gt;Ruby on Rails 3 template&lt;/a&gt; inspired by Mike Gunderloy’s &lt;a href="http://github.com/ffmike/BigOldRailsTemplate"&gt;BigOldRailsTemplate&lt;/a&gt; project. It was a very opinionated template, as it only created Rails applications using Mongoid, RSpec, jQuery, Haml, and FactoryGirl. This resulted in a large amount of forks(34 to date) by fans of the project who wanted to generate applications their way.&lt;/p&gt;
&lt;h3&gt;What is Rails Templater today?&lt;/h3&gt;
&lt;p&gt;The initial intentions of the template framework were small. I wanted something to generate applications the way I wanted, without all the configuration changes required after the initial generation. For example, if I wanted to use Mongoid with RSpec instead of ActiveRecord, I would have to update the RSpec configuration to take care of dropping MongoDB collections. Rails Templater takes care of all these configuration details in post bundler strategies, which take into account all the recipes chosen by the user.&lt;/p&gt;
&lt;p&gt;Rails Templater is no longer just a template, but a gem providing a simple interface for generating applications. Also, the project is now completely agnostic, thus allowing you to select what you want in your application. Some examples of choices are deciding which &lt;span class="caps"&gt;ORM&lt;/span&gt;, JavaScript framework, testing framework, and fixture replacement you want to use.&lt;/p&gt;
&lt;h3&gt;Usage&lt;/h3&gt;
&lt;p&gt;You can give Rails Templater a try right now with the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ gem install rails_templater&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once installed, generate a new Ruby on Rails 3 application using &lt;em&gt;templater&lt;/em&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ templater myapp&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Rails Templater will ask you questions, such as which testing framework you would like to use. Once all questions are answered, a new Rails application will be generated just the way you like it.&lt;/p&gt;
&lt;p&gt;Be sure to watch the screencast below to see an example of generating an app.&lt;/p&gt;
&lt;p&gt;&lt;iframe src="http://player.vimeo.com/video/19367709?title=0&amp;amp;byline=0&amp;amp;portrait=0&amp;amp;color=ffffff" width="949" height="534" frameborder="0"&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;h3&gt;Contributing new recipes&lt;/h3&gt;
&lt;p&gt;If you would like to add more recipes to the project, &lt;a href="https://github.com/kfaustino/rails-templater"&gt;fork it on GitHub&lt;/a&gt; and send me a pull request. The current road map is to add DataMapper support and more fixture replacements, such as Fabrication.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/zSwRmn8c004" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2011/01/rails-templater---agnostic-at-last</feedburner:origLink></item>
    <item>
      <title>Writing modular HTTP client code with Faraday</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/jNqxY0NrRdE/writing-modular-http-client-code-with-faraday</link>
      <pubDate>Thu, 23 Sep 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/09/writing-modular-http-client-code-with-faraday</guid>
      <description>&lt;p&gt;What is Faraday? A natural philosopher from the 1700s? An awesome Lost character? A ruby gem by &lt;a href="http://twitter.com/technoweenie"&gt;technoweenie&lt;/a&gt; himself, Rick Olson? Since this blog is mostly development related, you may have concluded that this post is about the latter. &lt;a href="http://github.com/technoweenie/faraday"&gt;Faraday&lt;/a&gt; is an &lt;span class="caps"&gt;HTTP&lt;/span&gt; client library inspired by Rack. Requests and Responses go through middleware which allow for abstraction and modular code.&lt;/p&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;gem install faraday&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Be sure to also install the &lt;a href="http://wynnnetherland.com/projects/faraday-middleware"&gt;faraday-middleware&lt;/a&gt; gem by &lt;a href="http://twitter.com/pengwynn"&gt;Wynn Netherland&lt;/a&gt; as it provides some great middleware to consume APIs.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gem install faraday-middleware&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Using Faraday&lt;/h2&gt;
&lt;p&gt;To create a connection via Faraday, instantiate a new &lt;em&gt;Faraday::Connection&lt;/em&gt; object with your desired options. The constructor of Faraday::Connection takes a block where you will define an adapter and your desired middleware.&lt;/p&gt;
&lt;p&gt;An adapter represents the client library that Faraday will be utilizing to make your request. Faraday ships with the following:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;NetHTTP (Faraday.default_adapter)&lt;/li&gt;
	&lt;li&gt;Patron&lt;/li&gt;
	&lt;li&gt;Typhoeus&lt;/li&gt;
	&lt;li&gt;Test (Allows stubbing of &lt;span class="caps"&gt;HTTP&lt;/span&gt; requests)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: Creating a connection&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;connection = Faraday::Connection.new(
  :url =&amp;gt; 'http://api.twitter.com/1/statuses/public_timeline.json',
  :headers =&amp;gt; { :accept =&amp;gt;  'application/json',
  :user_agent =&amp;gt; 'Faraday Ruby Client'}) do |builder|
    builder.adapter Faraday.default_adapter
    builder.use Faraday::Response::MultiJson
    builder.use Faraday::Response::Mashify
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The above example represents a Faraday connection to the Twitter &lt;span class="caps"&gt;API&lt;/span&gt; public timeline method. This connection uses two middlewares from the faraday-middleware gem. Faraday::Response::MultiJson sets the body of the response to a parsed &lt;span class="caps"&gt;JSON&lt;/span&gt; response using the &lt;a href="http://github.com/intridea/multi_json"&gt;multi_json&lt;/a&gt; gem. Afterwards, the Faraday::Response::Mashify middleware uses the &lt;a href="http://github.com/intridea/hashie"&gt;hashie&lt;/a&gt; gem to allow dot notation on the response body instead of brackets.&lt;/p&gt;
&lt;p&gt;By putting request/response operations in middleware, Faraday forces your code to follow the Single Responsibility Principle. For example, Faraday::Response::MultiJson is responsible for converting the &lt;span class="caps"&gt;JSON&lt;/span&gt; response into a ruby object using the best available &lt;span class="caps"&gt;JSON&lt;/span&gt; library and that alone.&lt;/p&gt;
&lt;p&gt;Calling methods on the connection object will allow you to perform &lt;span class="caps"&gt;GET&lt;/span&gt;, &lt;span class="caps"&gt;HEAD&lt;/span&gt;, &lt;span class="caps"&gt;PUT&lt;/span&gt;, &lt;span class="caps"&gt;POST&lt;/span&gt; or &lt;span class="caps"&gt;DELETE&lt;/span&gt; operations.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: Faraday response with MultiJson and Mashify&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;response = connection.get
first_user = response.body.first.user
puts first_user.screen_name&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Creating a Middleware&lt;/h2&gt;
&lt;p&gt;A common code practice when making client &lt;span class="caps"&gt;HTTP&lt;/span&gt; requests is to verify the response was successful. To abstract the response verification, move the code to Faraday response middleware. To create one, you must inherit from &lt;em&gt;Response::Middleware&lt;/em&gt; and implement the methods &lt;em&gt;self.register_on_complete&lt;/em&gt; and &lt;em&gt;initialize_. The interface is very similar to Rack. You can think of register_on&lt;/em&gt;complete(env) as call(env) from Rack.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: Twitter Error Response Middleware&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;module Faraday
  class Response::TwitterErrors &amp;lt; Response::Middleware

    begin
      def self.register_on_complete(env)
        env[:response].on_complete do |finished_env|
          case finished_env[:status]
          when 400
              raise Twitter::RateLimitExceeded,
                "#{finished_env[:body]['error'] if finished_env[:body]}"
            when 401
              raise Twitter::UnauthorizedError,
                "#{finished_env[:body]['error'] if finished_env[:body]}"
            when 500
              raise Twitter::ServerError, 'api.twitter.com is currently down'
          end
        end
      end
    rescue LoadError, NameError =&amp;gt; e
      self.load_error = e
    end

    def initialize(app)
      super
      @parser = nil
    end

  end
end&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Note&lt;/h2&gt;
&lt;p&gt;Faraday does not have gem dependencies for many of the adapters and middlewares used within it’s codebase. Ensure you have all necessary gems installed on your system.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/jNqxY0NrRdE" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/09/writing-modular-http-client-code-with-faraday</feedburner:origLink></item>
    <item>
      <title>34 Ruby on Rails 3 resources to get you started</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/_SVhrjEYZDA/34-ruby-on-rails-3-resources-to-get-you-started</link>
      <pubDate>Thu, 26 Aug 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/08/34-ruby-on-rails-3-resources-to-get-you-started</guid>
      <description>&lt;p&gt;With the &lt;del&gt;upcoming&lt;/del&gt; final release of Ruby on Rails 3 &lt;del&gt;around the corner&lt;/del&gt;, get up to speed quickly with the following 34 resources:&lt;/p&gt;
&lt;h2&gt;Overviews&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://guides.rubyonrails.org/3_0_release_notes.html"&gt;Rails 3.0 Release Notes&lt;/a&gt; &amp;#8211; RailsGuides is an invaluable resource for all Ruby on Rails developers. The Rails 3 release notes provides a great overview the api changes and new features added to the framework.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://railsplugins.org/"&gt;RailsPlugins.org&lt;/a&gt; – Find out if your plugins work in Rails 3.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://adventuresincoding.com/2010/07/having-ruby-on-rails-3-my-way/"&gt;Having Ruby on Rails 3 My Way&lt;/a&gt; &amp;#8211; A tutorial on how to setup Rails 3 with Mongoid, Haml, jQuery, and RSpec with Factory Girl.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://litanyagainstfear.com/blog/2010/02/03/the-rails-module/" title="in Rails 3"&gt;The Rails Module&lt;/a&gt; &amp;#8211; Nick Quaranto outlines some helpful methods in the Rails module.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.plataformatec.com.br/2010/02/rails-3-i18n-changes/"&gt;Rails 3 I18n changes&lt;/a&gt; &amp;#8211; A quick walkthrough the changes made to I18n.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://rubyonrails.org/screencasts/rails3"&gt;Ruby on Rails 3 Screencast series&lt;/a&gt; &amp;#8211; The official Ruby on Rails site screencast series by Gregg Pollack.&lt;/p&gt;
&lt;h2&gt;ActionController / Rack&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://blog.plataformatec.com.br/2009/08/embracing-rest-with-mind-body-and-soul/"&gt;Embracing &lt;span class="caps"&gt;REST&lt;/span&gt; with mind, body and soul&lt;/a&gt; &amp;#8211; José Valim introduces RESTful responders within Rails 3 controllers.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://railscasts.com/episodes/224-controllers-in-rails-3"&gt;Railscasts #224 Controllers in Rails 3&lt;/a&gt; – Ryan shows us what’s new with Rails 3 controllers.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.engineyard.com/blog/2010/render-options-in-rails-3/"&gt;Render Options in Rails 3&lt;/a&gt; &amp;#8211; Yehuda goes through the rendering options available in Rails 3.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://pivotallabs.com/users/jdean/blog/articles/1370-adding-routes-for-tests-specs-with-rails-3"&gt;Adding Routes for tests / specs with Rails 3&lt;/a&gt; &amp;#8211; Jeff Dean outlines how to verify routes in our specs.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://jasonseifer.com/2009/04/08/32-rack-resources-to-get-you-started"&gt;32 Rack Resources to Get You Started&lt;/a&gt; &amp;#8211; A great collection of links to get you familiar with rack.&lt;/p&gt;
&lt;h2&gt;ActionMailer&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://lindsaar.net/2010/1/26/new-actionmailer-api-in-rails-3"&gt;New ActionMailer &lt;span class="caps"&gt;API&lt;/span&gt; in Rails 3.0&lt;/a&gt; &amp;#8211; Mikel Lindsaar demonstrates how to use the new ActionMailer.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://railsdispatch.com/posts/actionmailer"&gt;A Whole New ActionMailer&lt;/a&gt; &amp;#8211; Mikel Lindsaar’s Rails Dispatch post giving a tour of the ActionMailer features.&lt;/p&gt;
&lt;h2&gt;ActiveRecord/ActiveModel&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/"&gt;ActiveModel: Make Any Ruby Object Feel Like ActiveRecord&lt;/a&gt; – Yehuda writes about the modularity of ActiveModel.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://railscasts.com/episodes/219-active-model"&gt;Railscasts #219 Active Model&lt;/a&gt; &amp;#8211; See how to include certain ActiveModel modules to tableless models.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://railsdispatch.com/posts/activerelation"&gt;ActiveRelation: ActiveRecord Gets a Facelift&lt;/a&gt; &amp;#8211; Carl Lerche introduces the new ActiveRecord finder api.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://m.onkey.org/2010/1/22/active-record-query-interface"&gt;Active Record Query Interface&lt;/a&gt; &amp;#8211; Pratik gives an overview of the changes made to the ActiveRecord query interface since Rails 2.&lt;/p&gt;
&lt;h2&gt;Bundler&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://gembundler.com/"&gt;Gembundler.com&lt;/a&gt; -The official project site for Bundler that includes extensive documentation.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://railsdispatch.com/posts/bundler"&gt;Library Management Gets an Update in Rails 3&lt;/a&gt; &amp;#8211; Andre Arko gives an overview about bundler for the Rails Dispatch blog.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://railscasts.com/episodes/201-bundler"&gt;Railscasts #201 Bundler&lt;/a&gt; &amp;#8211; A Railscasts by Ryan Bates demonstrating how to use bundler with Rails 3.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://adventuresincoding.com/2010/02/riding-ruby-on-rails-3-bundler/"&gt;AdventuresInCoding.com screencast on Bundler&lt;/a&gt; – Our very first screencast from last February.&lt;/p&gt;
&lt;h2&gt;Railties&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://www.igvita.com/2010/08/04/rails-3-internals-railtie-creating-plugins/"&gt;Rails 3 Internals: Railtie &amp;amp; Creating Plugins&lt;/a&gt; &amp;#8211; Ilya Grigorik goes over Railties in Rails 3.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://adventuresincoding.com/2010/07/jumpstart-your-ruby-on-rails-3-applications-with-rails-templater"&gt;rails-templater&lt;/a&gt; &amp;#8211; A template project which generates a greenfield Rails 3 application.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://caffeinedd.com/guides/331-making-generators-for-rails-3-with-thor"&gt;Making generators for Rails 3 with Thor&lt;/a&gt; – A tutorial showing you how to use the new generators and how to bundle them in a gem.&lt;/p&gt;
&lt;h2&gt;Routes&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/"&gt;The Lowdown on Routes in Rails 3&lt;/a&gt; &amp;#8211; Rizwan Reza gives us a great summary of all the different ways to create routes in Rails 3.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://edgeguides.rubyonrails.org/routing.html"&gt;Rails Routing from the Outside In&lt;/a&gt; &amp;#8211; RailsGuide documentation about the new router.&lt;/p&gt;
&lt;h2&gt;Plugins&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://weblog.rubyonrails.org/2010/2/9/plugin-authors-toward-a-better-future"&gt;Plugin Authors: Toward a Better Future&lt;/a&gt; &amp;#8211; Yehuda goes through the changes for making plugins in Rails 3.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://railsdispatch.com/posts/building-or-updating-a-rails-3-plugin"&gt;Customizing Rails Apps with Plugins&lt;/a&gt; &amp;#8211; José Valim gives an overview of using responders, simple form, devise, and mail form plugins.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.plataformatec.com.br/2010/08/devise-1-1-is-out-and-ready-to-rock-with-rails-3/"&gt;Devise 1.1 is out and ready to rock with Rails 3&lt;/a&gt; &amp;#8211; Outlines some new feature in Devise 1.1 including being able to authenticate a given url in the router!&lt;/p&gt;
&lt;h2&gt;Books&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://beginningrails.com/"&gt;Beginning Rails 3&lt;/a&gt; – Cloves Carneiro Jr and Rida Al Barazi bring us a great beginner Rails 3 book with examples viewable in gists.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://my.safaribooksonline.com/9780132480345"&gt;The Rails 3 Way&lt;/a&gt; &amp;#8211; The ultimate Ruby on Rails reference by Obie Fernandez.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.manning.com/katz/"&gt;Rails 3 In Action&lt;/a&gt; &amp;#8211; Ryan Bigg and Yehuda Katz deliver a great Rails book which teaches readers Rails by doing &lt;span class="caps"&gt;BDD&lt;/span&gt; with Cucumber and RSpec.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.railsupgradehandbook.com/"&gt;Rails 3 Upgrade Handbook&lt;/a&gt; &amp;#8211; Jeremy McAnally’s book gives you 120 pages of information about upgrading your Rails 2 application to version 3.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://railstutorial.org/"&gt;Ruby on Rails Tutorial: Learn Rails by Example&lt;/a&gt; – Michael Hartl’s ebook that teaches Rails step by step.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;:  Rails 3.0.0 was released on August 29th, 2010. To get more details, be sure to read the &lt;a href="http://weblog.rubyonrails.org/2010/8/29/rails-3-0-it-s-done"&gt;official announcement&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/_SVhrjEYZDA" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/08/34-ruby-on-rails-3-resources-to-get-you-started</feedburner:origLink></item>
    <item>
      <title>Prototypal Inheritance in JavaScript Explained</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/_v09mQGArjo/prototypal-inheritance-in-javascript-explained</link>
      <pubDate>Tue, 27 Jul 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/07/prototypal-inheritance-in-javascript-explained</guid>
      <description>&lt;p&gt;One of the more advanced topics in JavaScript is how to implement inheritance in your code. The reason why inheritance causes so much confusion is because there are so many ways to implement it in JavaScript.&lt;/p&gt;
&lt;p&gt;For those who are unfamiliar with inheritance, it allows us to extend a previously existing entity and supplement it by adding methods/properties to create an entirely new entity. It is an amazing way to reuse code!&lt;/p&gt;
&lt;p&gt;Here is &lt;a href="http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)"&gt;Wikipedia’s&lt;/a&gt; definition:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“In object-oriented programming(&lt;span class="caps"&gt;OOP&lt;/span&gt;), Inheritance is a way to compartmentalize and reuse code by creating collections of attributes and behaviors called objects which can be based on previously created objects”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There are a variety of JavaScript frameworks that provide a means to perform classical inheritance. Some of these include &lt;a href="http://www.prototypejs.org/learn/class-inheritance"&gt;Prototype&lt;/a&gt;, &lt;a href="http://mootools.net/docs/core/Class/Class"&gt;MooTools&lt;/a&gt;, and &lt;a href="http://jsclass.jcoglan.com/"&gt;ClassJS&lt;/a&gt;. This is a great option for a team where most of the developers come from other object-oriented languages. Even though the above implementations are viable solutions, Douglas Crockford suggests the ideal solution is to use the prototypal inheritance, which has objects inheriting from other objects&lt;/p&gt;
&lt;h2&gt;Implementation&lt;/h2&gt;
&lt;p&gt;In JavaScript everything is an object, there is no concept of a class like other object-oriented programming languages. With prototypal inheritance, we implement inheritance by creating objects which will act as prototypes for other objects.&lt;/p&gt;
&lt;p&gt;My favourite implementation comes from Stoyan Stefanov’s book &lt;a href="http://www.amazon.com/Object-Oriented-JavaScript-high-quality-applications-libraries/dp/1847194141/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1280256010&amp;amp;sr=8-1"&gt;Object-Oriented JavaScript: Create scalable, reusable high-quality JavaScript applications, and libraries&lt;/a&gt;. Here is my slightly modified version of a function which abstracts the creation of a child object:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;function object(parent, supplements){
  /*  Create a variable that will store our child object. */
  var child;

  /*  Create an empty function F which will act as an intermediary between
      the parent and the child. F will have no properties of its own.	*/
  function F() {};

  /*  Assign the parent constructor to the prototype of F.
      This will allow the child to copy all the parent’s properties without
      having to set it’s prototype to the parent instance. */
  F.prototype = parent;

  /*  Create a new child object from F. We get a copy of all the parent’s properties.
      Functions/objects are copied by reference. */
  child = new F();

  /*  Define a property uber which points to the parent object. Simulates super
      from other languages. */
  child.uber = parent;

  /*  Add any functions/properties desired for the child object. */
  for(var i in supplements){
    child[i] = supplements[i]
  }

  return child;
};&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Example&lt;/h2&gt;
&lt;p&gt;Here is a basic example displaying how the properties are copied and overridden in a parent/child relationship.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;var parent = {
  firstName: "William",
  lastName: "Adama",
  fullName: function() {
    return this.firstName + " " + this.lastName;
  }
};

var child = object(parent, {
  firstName: "Lee"
});

child.fullName(); // "Lee Adama"
parent.fullName(); // "William Adama"
We can implement another version of fullName() that indicates William is Lee’s father without removing the parent function.

child.fullName = function(){
  return this.uber.fullName() + "'s child " + this.firstName;
};

child.fullName(); // "William Adama's child Lee"
parent.fullName(); // "William Adama"&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We can even remove our child’s fullName() function and still have access to out parent’s function because it exists in the child’s prototype chain.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;delete child.fullName
child.fullName(); // "Lee Adama"&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Benefits&lt;/h2&gt;
&lt;p&gt;The benefit of using prototypal inheritance is that we are working with the strengths of JavaScript and not trying to imitate features of another language.&lt;/p&gt;
&lt;p&gt;Not only does it provide an easy way to do inheritance, but there is a performance boost as well. When a function is defined in an object, they are created by reference, resulting in all child objects pointing to the same function and not creating their own copies. This can also lead to some issues if you are unaware of this. If you do not want to share any objects or functions in your child object, make sure to supplement them. Any functions/objects you create in your child object will take precedence over the parent’s version.&lt;/p&gt;
&lt;h2&gt;Out in the Wild&lt;/h2&gt;
&lt;p&gt;In the latest ECMAScript 5 standard, prototypal inheritance became a first class citizen as a new native method &lt;a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object/create" title="proto [, propertiesObject ]"&gt;Object.create&lt;/a&gt; was added. It allows you to create a new object with the specified prototype object and properties. You can also use it today in &lt;a href="http://www.yuiblog.com/blog/2010/01/06/inheritance-patterns-in-yui-3/"&gt;&lt;span class="caps"&gt;YUI&lt;/span&gt; 3&lt;/a&gt; via the Y.Object(…) function from &lt;span class="caps"&gt;YUI&lt;/span&gt; core.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/_v09mQGArjo" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/07/prototypal-inheritance-in-javascript-explained</feedburner:origLink></item>
    <item>
      <title>How to configure Cucumber and RSpec to work with Mongoid</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/o6kXkBGUdLM/how-to-configure-cucumber-and-rspec-to-work-with-mongoid</link>
      <pubDate>Thu, 22 Jul 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/07/how-to-configure-cucumber-and-rspec-to-work-with-mongoid</guid>
      <description>&lt;p&gt;RSpec and Cucumber by default are setup to work with relational databases using ActiveRecord. This has been fine for the most part until so many NoSQL databases have come onto the scene. Let’s focus on getting Cucumber and RSpec working with MongoDB using Mongoid.&lt;/p&gt;
&lt;p&gt;First you will need to setup your Rails 3 application to use &lt;a href="http://adventuresincoding.com/2010/07/having-ruby-on-rails-3-my-way/"&gt;Mongoid, Cucumber, RSpec, and Factory Girl&lt;/a&gt;. Once you have a project skeleton, you will need to setup RSpec to drop all the MongoDB collections of the project before each spec is run to ensure a clean test harness.&lt;/p&gt;
&lt;p&gt;The best command to drop your MongoDB collections comes from Mongoid creator Durran Jordan in Mongoid’s &lt;a href="http://github.com/durran/mongoid/blob/master/spec/spec_helper.rb#L32"&gt;code base&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&amp;amp;:drop)&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;RSpec&lt;/h2&gt;
&lt;p&gt;Here is a sample RSpec configuration which will empty your MongoDB db and also use Factory Girl to create your models. Note that &lt;em&gt;config.user_transactional_fixtures&lt;/em&gt; is commented out.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# spec_helper.rb

ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'remarkable/active_model'
require 'remarkable/mongoid'
require 'factory_girl'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

RSpec.configure do |config|
  config.mock_with :rspec

  # If you're not using ActiveRecord, or you'd prefer not to run each of your
  # examples within a transaction, comment the following line or assign false
  # instead of true.
  # config.use_transactional_fixtures = true

    config.before :each do
      Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&amp;amp;:drop)
    end

end&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Cucumber&lt;/h2&gt;
&lt;p&gt;Cucumber allows defining hooks in any file under the &lt;em&gt;features/support&lt;/em&gt; directory. To begin setting up Cucumber, first create a file &lt;em&gt;features/support/hooks.rb&lt;/em&gt; that will drop your MongoDB collections before each scenario.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# features/support/hooks.rb

Before do |scenario|
    Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&amp;amp;:drop)
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I also find that using Factory Girl for my Cucumber scenarios makes my life a lot easier. Below is an example features/support/env.rb file which will import all your factories. It will also provide some already defined step definitions by the guys at &lt;a href="http://thoughtbot.com/"&gt;thoughtbot&lt;/a&gt;. Be sure to read about them in their post &lt;a href="http://robots.thoughtbot.com/post/284805810/gimme-three-steps"&gt;gimme three steps&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# env.rb

ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')

require 'cucumber/formatter/unicode'
require 'cucumber/rails/rspec'
require 'cucumber/rails/world'
require 'cucumber/web/tableish'

require 'capybara/rails'
require 'capybara/cucumber'
require 'capybara/session'
require 'cucumber/rails/capybara_javascript_emulation'

Capybara.default_selector = :css

ActionController::Base.allow_rescue = false

require 'factory_girl'
require 'factory_girl/step_definitions'
Dir[File.expand_path(File.join(File.dirname(__FILE__),'..','..',
  'spec','factories','*.rb'))].each {|f| require f}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;All the step definitions from &lt;em&gt;factory_girl/step_definitions&lt;/em&gt; work except for “create record &amp;amp; set one attribute”:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Given an author exists with an email of "author@example.com"&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The reason for this is because in the Factory girl &lt;a href="http://github.com/thoughtbot/factory_girl/blob/master/lib/factory_girl/step_definitions.rb#L41"&gt;code&lt;/a&gt;, there is a check that determines if the given model responds to :columns. To get around this, add the following code to a new file &lt;em&gt;features/step_definitions/mongoid_steps.rb&lt;/em&gt;_:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# features/step_definitions/mongoid_steps.rb

Given /^an? (.+) exists with an? (.+) of "([^"]*)"$/ do |model, field, value|
  factory_name = model.gsub(' ', '_')
  Factory factory_name, field =&amp;gt; value
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;del&gt;The last thing to do is stub out the rake task for db:test:prepare. The Cucumber rake tasks are still dependent on the ActiveRecord test workflow and will attempt to load the db schema into the test db. Create the  file lib/tasks/mongo.rake to get around this:&lt;/del&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: As of version 2.0.0.beta.14 of mongoid, a stubbed rake task for db:test:clone is included.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# lib/tasks/mongo.rake

namespace :db do
  namespace :test do
    task :prepare do
      # Stub out for MongoDB
    end
  end
end&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Finally, if you don’t want to do this everytime you setup an application, I’ve updated &lt;a href="http://github.com/kfaustino/rails-templater"&gt;rails-templater&lt;/a&gt; to do the above steps automatically.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/o6kXkBGUdLM" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/07/how-to-configure-cucumber-and-rspec-to-work-with-mongoid</feedburner:origLink></item>
    <item>
      <title>Jumpstart your Ruby on Rails 3 applications with rails-templater</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/-lTa8JRTLtg/jumpstart-your-ruby-on-rails-3-applications-with-rails-templater</link>
      <pubDate>Mon, 19 Jul 2010 06:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/07/jumpstart-your-ruby-on-rails-3-applications-with-rails-templater</guid>
      <description>&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Rails Templater is now a &lt;a href="http://adventuresincoding.com/2011/01/rails-templater---agnostic-at-last"&gt;gem and agnostic&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In &lt;a href="http://adventuresincoding.com/2010/07/having-ruby-on-rails-3-my-way/"&gt;Having Ruby on Rails my way&lt;/a&gt;, I outlined how to manually setup your Ruby on Rails 3 application to use custom generators for Mongoid, Haml, jQuery, RSpec, and factory_girl.&lt;/p&gt;
&lt;p&gt;To simplify things further, I have started a template project called &lt;a href="http://github.com/kfaustino/rails-templater"&gt;rails-templater&lt;/a&gt;. It is inspired by Mike Gunderloy’s &lt;a href="http://github.com/ffmike/BigOldRailsTemplate"&gt;BigOldRailsTemplate&lt;/a&gt; project which provides templates for Rails 2.3.x projects. To get started, clone the rails-templater repository to your hard drive:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;% git clone http://github.com/kfaustino/rails-templater.git&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you are ready to create a new Rails 3 application, run:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;% rails new app_name -JOT -m \
 /path/to/rails-tempater/templater.rb&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Optionally you can also use &lt;a href="http://compass-style.org/"&gt;Compass&lt;/a&gt; as your stylesheet framework and &lt;a href="http://github.com/aslakhellesoy/cucumber"&gt;Cucumber&lt;/a&gt; for integration testing.&lt;/p&gt;
&lt;p&gt;I will be continuously making updates to the project by adding new recipes and template options.&lt;/p&gt;
&lt;p&gt;Be sure to check out the project &lt;a href="http://github.com/kfaustino/rails-templater"&gt;GitHub page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Photo credit: &lt;a href="http://www.flickr.com/photos/dystopos/459452832/"&gt;Railroad in Crestwood&lt;/a&gt; by dystopos&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/-lTa8JRTLtg" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/07/jumpstart-your-ruby-on-rails-3-applications-with-rails-templater</feedburner:origLink></item>
    <item>
      <title>Having Ruby on Rails 3 my way</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/XDUkmOF7OjM/having-ruby-on-rails-3-my-way</link>
      <pubDate>Mon, 19 Jul 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/07/having-ruby-on-rails-3-my-way</guid>
      <description>&lt;p&gt;At RailsConf 2009, David Heinemeier Hansson during his &lt;a href="http://railsconf.blip.tv/file/2081411/"&gt;keynote&lt;/a&gt; mentioned that one of the central themes behind the Ruby on Rails and Merb merge was to “Have it your way”. Given the fact that Rails 3 is almost at a release candidate, I wanted to share my ideal Ruby on Rails setup.&lt;/p&gt;
&lt;p&gt;My ideal application stack consists of Mongoid as my &lt;span class="caps"&gt;ODM&lt;/span&gt;, Haml as my template engine, jQuery as my JavaScript framework, RSpec as my testing framework, and factory_girl as my fixture replacement.&lt;/p&gt;
&lt;p&gt;I will outline how to setup each of these individually for your Ruby on Rails 3 application.&lt;/p&gt;
&lt;p&gt;To begin, generate a new Rails 3 application with the following command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;% rails new app_name -TOJ&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The flags passed into the rails command will remove certain elements from the generation of our application.&lt;/p&gt;
&lt;p&gt;T – represents Test::Unit&lt;br /&gt;
O – represents ActiveRecord&lt;br /&gt;
J – represents Prototype&lt;/p&gt;
&lt;h2&gt;Replacing ActiveRecord with Mongoid&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://mongoid.org/"&gt;Mongoid&lt;/a&gt; is an Object Document Mapper for &lt;a href="http://www.mongodb.org/"&gt;MongoDB&lt;/a&gt;. It has a beautiful chaining criteria dsl for queries and is optimized for extremely large datasets.&lt;/p&gt;
&lt;p&gt;To add mongoid to your project, add the following to your Gemfile:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gem ‘mongoid’, ‘&amp;gt;= 2.0.0.beta14’
gem ‘bson_ext’, ‘1.0.4’&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Mongoid provides a generator to setup your project to create mongoid documents for model generation and setup a sample database connection configuration. To run this generator, first execute bundle install to ensure all missing dependencies are installed. Finally, run the &lt;em&gt;mongoid:config&lt;/em&gt; generator:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;% rails g mongoid:config&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Replacing &lt;span class="caps"&gt;ERB&lt;/span&gt; with Haml&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://haml-lang.com/"&gt;Haml&lt;/a&gt; was one of the primary reasons why I feel in love with working on Ruby on Rails applications. It just makes working with markup a pleasure.&lt;/p&gt;
&lt;p&gt;Adding Haml to your project requires only 2 lines in your Gemfile:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gem ‘rails3-generators’
gem ‘haml’&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The gem &lt;a href="http://github.com/indirect/rails3-generators"&gt;rails3-generators&lt;/a&gt; provides a variety of generators for Ruby on Rails 3 applications including factory_girl which we will be using later.&lt;/p&gt;
&lt;p&gt;In config/application.rb, add the following to your application configuration:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;config.generators do |g|
  g.template_engine :haml
end&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Replacing Prototype with jQuery&lt;/h2&gt;
&lt;p&gt;Using &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; simplifies dealing with the &lt;span class="caps"&gt;DOM&lt;/span&gt; and provides all the tools necessary to do unobtrusive JavaScript in your web application. According to &lt;a href="http://survey.hamptoncatlin.com/"&gt;Hampton Catlin’s 2010 ruby survey&lt;/a&gt;, 78.8% of all ruby users prefer it over Prototype.&lt;/p&gt;
&lt;p&gt;Run the following two commands in the root of your project directory:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;curl -L http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js &amp;gt; \
public/javascripts/jquery.js

curl -L http://github.com/rails/jquery-ujs/raw/master/src/rails.js &amp;gt; \
public/javascripts/rails.js&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once you setup a layout file, include the two javascript files and your set.&lt;/p&gt;
&lt;h2&gt;Replacing Test::Unit with RSpec&lt;/h2&gt;
&lt;p&gt;With the latest beta release of &lt;a href="http://github.com/rspec/rspec-rails"&gt;RSpec 2&lt;/a&gt;, all generators and rake tasks are now exposed through a Railtie.&lt;/p&gt;
&lt;p&gt;To replace Test::Unit as your default test framework, include the &lt;em&gt;rspec-rails&lt;/em&gt; gem in both the :development and :test group in your Gemfile:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;group :development, :test do
  gem ‘rspec-rails’, ‘&amp;gt;= 2.0.0.beta.19’
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The next step is to install rspec into the application. The &lt;em&gt;rspec:install&lt;/em&gt; generator will create a spec directory and some skeleton files. Run the following in your project root:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;% bundle install
% rails g rspec:install&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Even though you are including RSpec as a development environment dependency, it is not completely loaded. It is only completely loaded when you invoke rails generate or rake. Read more details about this change at David Chelimsky’s post &lt;a href="http://blog.davidchelimsky.net/2010/07/11/rspec-rails-2-generators-and-rake-tasks-part-ii/"&gt;rspec-rails-2 generators and rake tasks – part II&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Replacing Fixtures with Factory Girl&lt;/h2&gt;
&lt;p&gt;The rails3-generators gem we included earlier also provides some &lt;a href="http://github.com/thoughtbot/factory_girl"&gt;factory_girl&lt;/a&gt; generators. This allows for the creation of a factory when we use the model generator from Rails.&lt;/p&gt;
&lt;p&gt;Add a dependency to the factory_girl_rails to the test environment in your Gemfile:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gem 'factory_girl_rails', :group =&amp;gt; :test&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You will also need to manually configure your generators to use factory_girl in config/application.rb. Your generators configuration should now look like the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;config.generators do |g|
  g.template_engine :haml
  g.fixture_replacement :factory_girl, :dir =&amp;gt; "spec/factories"
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: If you absolutely love this stack, be sure to check out &lt;a href="http://adventuresincoding.com/2010/07/jumpstart-your-ruby-on-rails-3-applications-with-rails-templater"&gt;rails-templater&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/XDUkmOF7OjM" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/07/having-ruby-on-rails-3-my-way</feedburner:origLink></item>
    <item>
      <title>10 TextMate bundles/plugins to boost your Ruby on Rails development productivity</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/oC8La0cjnl8/10-textmate-bundlesplugins-to-boost-your-ruby-on-rails-development-productivity</link>
      <pubDate>Mon, 31 May 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/05/10-textmate-bundlesplugins-to-boost-your-ruby-on-rails-development-productivity</guid>
      <description>&lt;p&gt;&lt;a href="http://macromates.com/"&gt;TextMate&lt;/a&gt; is a widely used &lt;span class="caps"&gt;GUI&lt;/span&gt; text editor that many in the Ruby on Rails community use. The editor benefits from a large and active community of users whom develop bundles and plugins that extend TextMate’s functionality to work with a wide variety of languages and libraries.&lt;/p&gt;
&lt;p&gt;Here are ten of my favourite bundles and plugins available to TextMate that will save you time and effort while working with Ruby on Rails:&lt;/p&gt;
&lt;p&gt;1. &lt;a href="http://peepcode.com/products/peepopen"&gt;PeepOpen&lt;/a&gt; – One of the best features of TextMate is fuzzy search(Command-T) which allows you to find files in your project with just a few characters of the filename. The issue with fuzzy search is that it becomes hard to pinpoint a file when there are many files with the same name in your project. Working in Ruby on Rails, you will face an endless amount repeated filenames in your views such as index.html.erb. Geoffrey Grosenbach from PeepCode, has developed an application PeepOpen that replaces the default fuzzy search with a beautiful fuzzy search that also allows you to pinpoint directories within your search. For a mere $9.00, it is a must own add-on to TextMate.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.adventuresincoding.com/images/posts/peepopen.png" title="PeepOpen" alt="PeepOpen" /&gt;&lt;/p&gt;
&lt;p&gt;2. &lt;a href="http://github.com/carlosbrando/ruby-on-rails-tmbundle"&gt;Ruby on Rails&lt;/a&gt; – Ruby on Rails development just got better with the recent changes made by Carlos Brando to &lt;a href="http://github.com/drnic/ruby-on-rails-tmbundle"&gt;Dr. Nic’s bundle&lt;/a&gt;. Not only does it include all the snippets and Rails integrations we are all used to, but now we also get a pseudo-intellisense for attributes for each ActiveRecord model in your project. One of my favourite additions to the bundle is the ability to easily create &lt;a href="http://adventuresincoding.com/2010/01/taking-the-helm-of-ruby-with-ruby-version-manager/"&gt;&lt;span class="caps"&gt;RVM&lt;/span&gt;&lt;/a&gt; .rvmrc files for your project.  The best resource for this bundle is &lt;a href="http://peepcode.com/products/textmate-for-rails-2"&gt;PeepCode’s TextMate for Rails 2 screencast&lt;/a&gt;, be sure to check it out.&lt;/p&gt;
&lt;p&gt;3. &lt;a href="http://github.com/protocool/AckMate"&gt;AckMate&lt;/a&gt; – If you need to find some text fast, AckMate is your answer. By default, you have the power of regular expressions to pinpoint even the most complex pattern of text. AckMate also allows the filtering of files by specifying file extensions and pattern matching if a filename contains certain text.&lt;/p&gt;
&lt;p&gt;&lt;img title="AckMate" src="http://media.adventuresincoding.com/images/posts/ackmate.png" width="408" height="421"&gt;&lt;/p&gt;
&lt;p&gt;4. &lt;a href="http://github.com/subtleGradient/javascript-tools.tmbundle"&gt;JavaScript Tools&lt;/a&gt; – JavaScript is ingrained in web development regardless of the server technology being utilized. Using the JavaScript Tools bundle you get all of the following:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;JavaScript Lint to check all your source code for common JavaScript mistakes&lt;/li&gt;
	&lt;li&gt;A JavaScript beautifier to uniform line breaks and indentation&lt;/li&gt;
	&lt;li&gt;Packing and minimizer tools to compress your JavaScript documents for production&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;5. &lt;a href="http://github.com/kswedberg/jquery-tmbundle"&gt;JavaScript jQuery&lt;/a&gt; – jQuery is the most popular JavaScript library available today. This bundle by jQuery team member Karl Swedberg and Jonathan Chaffer provides a huge amount of snippets to save you some keystrokes when working with jQuery.&lt;/p&gt;
&lt;p&gt;6. &lt;a href="http://github.com/jcf/git-tmbundle"&gt;Git&lt;/a&gt; – The Git bundle provides access to common Git commands without leaving your editor. Do things like viewing your uncommitted changes, find out who made that bad code change, and commit your changes to the repository.&lt;/p&gt;
&lt;p&gt;7 &amp;amp; 8. &lt;a href="http://github.com/dchelimsky/rspec-tmbundle"&gt;rSpec&lt;/a&gt; /&lt;a href="http://github.com/bmabey/cucumber-tmbundle"&gt;Cucumber&lt;/a&gt; – Outside-in Rails development has never been easier with Behaviour Driven Development (&lt;span class="caps"&gt;BDD&lt;/span&gt;) tools rSpec and Cucumber. These bundles allow for the running of specs and features from within TextMate and provide an &lt;span class="caps"&gt;HTML&lt;/span&gt; output of the results.&lt;/p&gt;
&lt;p&gt;9. &lt;a href="http://github.com/mocoso/code-beautifier.tmbundle"&gt;Code Beautifier&lt;/a&gt; –  TextMate does a good job of formatting your code but there is room for improvement. Using the Option-Command-B keyboard combination, the Code Beautifier bundle will clean up any white space and fix indentation in your ruby code. This is one of my most used bundles when I work with TextMate.&lt;/p&gt;
&lt;p&gt;10. &lt;a href="http://github.com/grimen/compass_blueprint_tmbundle"&gt;Compass + Blueprint&lt;/a&gt; – &lt;a href="http://compass-style.org/"&gt;Compass&lt;/a&gt; is the amazing Sass framework which cuts down development time by providing mixins and a means for doing unobtrusive &lt;span class="caps"&gt;CSS&lt;/span&gt;. This Compass bundle focuses on snippets for the popular Blueprint &lt;span class="caps"&gt;CSS&lt;/span&gt; framework.&lt;/p&gt;
&lt;p&gt;Give these bundles/plugins a try and be sure to let me know of any you think belong on this list.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/oC8La0cjnl8" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/05/10-textmate-bundlesplugins-to-boost-your-ruby-on-rails-development-productivity</feedburner:origLink></item>
    <item>
      <title>How to setup Git to use Diffmerge</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/TPDO7DR-_S4/how-to-setup-git-to-use-diffmerge</link>
      <pubDate>Sat, 03 Apr 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/04/how-to-setup-git-to-use-diffmerge</guid>
      <description>&lt;p&gt;Merge conflicts, they are bound to happen sooner or later when you are working in parallel with a team of developers. When Git cannot automatically merge changes, a merge fails and the conflicted file becomes littered with &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;, ===, and &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; markers.  To ease the pain of having to performing merges, Git allows using one of many supported merge tools or you can configure Git to use the tool of your choice instead.&lt;/p&gt;
&lt;p&gt;In this post, I am going to show you how to do the latter in Mac OS X using my preferred merge tool, &lt;a href="http://www.sourcegear.com/diffmerge/index.html"&gt;Diffmerge&lt;/a&gt;.  Diffmerge is a free graphical file comparison tool by SourceGear available in Mac OS X, Linux, and Windows. It is ideal to perform 3-way merges as it supports 3-way file comparison. During a conflict, you are presented with the version of the branch you are working on, the common file ancestor, and the branch you are merging in.&lt;/p&gt;
&lt;h2&gt;Visual Mergetool Configuration&lt;/h2&gt;
&lt;p&gt;Running the following commands in your terminal will set Diffmerge as your default visual mergetool:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git config --global merge.tool diffmerge

git config --global mergetool.diffmerge.cmd "diffmerge --merge
--result=\$MERGED \$LOCAL \$BASE \$REMOTE"

git config --global mergetool.diffmerge.trustExitCode true&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As of the 3.3 release of Diffmerge, exiting a visual merge will return the correct status to Git. Prior to this release, Diffmerge would always return 0, indicating that the merge was resolved even on aborted merges. When you attempt to close Diffmerge, you will be prompted to choose if the merge is to be aborted or is resolved.&lt;/p&gt;
&lt;p&gt;To start a 3-way merge with your visual mergetool, run:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git mergetool&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will perform a visual merge for each file in conflict. You may also provide an optional file parameter, to perform a merge on a specific file.&lt;/p&gt;
&lt;h3&gt;Don’t store backups&lt;/h3&gt;
&lt;p&gt;By default, Git will store a backup of the original file with conflict markers after a successful merge. These files will have a .orig extension added to the original filename. When I configure Git, I ensure that these files are not saved. To globally disable backups of the original merge file, run the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git config --global mergetool.keepBackup false&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Visual Difftool Configuration&lt;/h2&gt;
&lt;p&gt;You may also setup Diffmerge to be your visual Difftool by running the following commands in your terminal:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git config --global diff.tool diffmerge
git config --global difftool.diffmerge.cmd "diffmerge \$LOCAL \$REMOTE"&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will allow you to compare two different versions of files visually. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git difftool master~1 foo.rb&lt;/code&gt;&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/TPDO7DR-_S4" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/04/how-to-setup-git-to-use-diffmerge</feedburner:origLink></item>
    <item>
      <title>Binged In Action</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/Jwiq2oFrNX4/binged-in-action</link>
      <pubDate>Sun, 21 Mar 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/03/binged-in-action</guid>
      <description>&lt;p&gt;In our &lt;a href="http://adventuresincoding.com/2010/03/outsource-your-site-wide-search-with-binged/"&gt;last post&lt;/a&gt;, we introduced &lt;a href="http://github.com/kfaustino/binged"&gt;Binged&lt;/a&gt;, a simple api wrapper for the Bing &lt;span class="caps"&gt;API&lt;/span&gt;. To demonstrate how to utilize this gem in your Ruby on Rails projects, view the screencast below:&lt;/p&gt;
&lt;p&gt;&lt;iframe src="http://player.vimeo.com/video/10337665?title=0&amp;amp;byline=0&amp;amp;portrait=0" width="615" height="335" frameborder="0"&gt;&lt;/iframe&gt;&lt;p&gt;A screencast demonstrating how to use the binged gem to display bing search results.&lt;/p&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/Jwiq2oFrNX4" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/03/binged-in-action</feedburner:origLink></item>
    <item>
      <title>Outsource your site-wide search with Binged</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/QG6-HsfmLco/outsource-your-site-wide-search-with-binged</link>
      <pubDate>Mon, 15 Mar 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/03/outsource-your-site-wide-search-with-binged</guid>
      <description>&lt;h2&gt;Why use Bing for your site?&lt;/h2&gt;
&lt;p&gt;The &lt;a href="http://www.bing.com/developers"&gt;Bing &lt;span class="caps"&gt;API&lt;/span&gt;&lt;/a&gt; does not cost you a single penny to use. It’s completely free! Bing’s biggest competitor, &lt;a href="http://www.google.com/sitesearch/"&gt;Google Site Search&lt;/a&gt; on the other hand can cost you from $100 annually to a price point only known by calling a google sales representative. Looking at the their small business plan, it will cost $250 annually for 1,001 – 5000 indexed pages. If your site has a lot of pages, you will start feeling very limited. Using the Bing &lt;span class="caps"&gt;API&lt;/span&gt;, you have access to the same results as the Bing search engine and not a small subset. The one limitation to the &lt;span class="caps"&gt;API&lt;/span&gt; is that you can only request the first 1000 results of a query. If your site displays 20 results per page, that is a total of 50 pages of search results.&lt;/p&gt;
&lt;p&gt;Bing also provides unlimited bandwidth for queries as long as you make less than 7 queries per second per IP address. In a single day, you can query 518,400 times per server. That is a magnitude of search queries that will satisfy even large web applications. Compare this with the $750 annual google plan that only allows 500,000 queries per year!&lt;/p&gt;
&lt;p&gt;Finally,  the another great benefit of using the Bing &lt;span class="caps"&gt;API&lt;/span&gt; is that you can style the results to match the look and feel of your site.&lt;/p&gt;
&lt;h3&gt;The Rules&lt;/h3&gt;
&lt;p&gt;Based on the &lt;a href="http://www.bing.com/developers/tou.aspx"&gt;Bing Web Services &lt;span class="caps"&gt;API&lt;/span&gt; Terms of Use&lt;/a&gt;, the following rules must be followed in order to use Bing:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;It is to only be used for display in your Website or application.&lt;/li&gt;
	&lt;li&gt;You must display some form of attribution to Bing compliant with the Microsoft branding rules.&lt;/li&gt;
	&lt;li&gt;Do not filter any results you request.&lt;/li&gt;
	&lt;li&gt;If you interleave with other sources, you must clearly differentiate those sources.&lt;/li&gt;
	&lt;li&gt;Be sure to read the full Terms of Use to know exactly what you are entitled to.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Bing in Ruby via Binged&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://github.com/kfaustino/binged"&gt;Binged&lt;/a&gt; is a ruby gem I wrote that wraps the Bing &lt;span class="caps"&gt;API&lt;/span&gt;. It allows ruby developers to work with bing using all the common ruby syntax and idioms they know. Binged also has a chainable query syntax to allow easy query construction based on a large set of available filters.&lt;/p&gt;
&lt;h3&gt;Installation&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;[sudo] gem install binged&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Get Your Bing &lt;span class="caps"&gt;API&lt;/span&gt; key&lt;/h3&gt;
&lt;p&gt;To use binged, you will require a Bing &lt;span class="caps"&gt;API&lt;/span&gt; key. Create one at: &lt;a href="http://www.bing.com/developers/createapp.aspx"&gt;http://www.bing.com/developers/createapp.aspx&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Usage&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Instantiate a Client&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;binged = Binged::Client.new(:api_key =&amp;gt; 'binged')&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The client is used to search via different sources and holds a reference to your api key to simplify calls to the &lt;span class="caps"&gt;API&lt;/span&gt;.&lt;/p&gt;
&lt;h3&gt;Ruby on Rails configuration&lt;/h3&gt;
&lt;p&gt;Binged allows for configuration to be done once using a configure block. To use binged in your Ruby on Rails project, configure it globally in an initializer like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# config/initializers/binged.rb
Binged.configure do |config|
  config.api_key = 'api_key'
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Globally configuring Binged removes the need to provide the client with any credentials or options in your code as they would have already been set. For example, defining a client would be as follows:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;binged = Binged::Client.new&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Web Search Example&lt;/h3&gt;
&lt;p&gt;The following example demonstrates how to search within a specific site for a keyword and provide a maximum of 30 results:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Binged::Client.new.web('ruby').from_site('adventuresincoding.com').per_page(30).each do |result|
  puts result.title
  puts result.description
  puts result.url
end&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;For simple site-wide search, Bing is the optimal solution for most web applications. It is free and the usage limits are so  lax, they can almost be thought of as unlimited. Be sure to check out the &lt;a href="http://kfaustino.github.com/binged/"&gt;Binged documentation&lt;/a&gt; to get a grasp of all the conditions you can specify in your queries. If you find a bug or have a great feature idea, &lt;a href="http://github.com/kfaustino/binged/issues"&gt;create an issue&lt;/a&gt; over at github.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;View the &lt;a href="http://adventuresincoding.com/2010/03/binged-in-action/"&gt;Binged screencast&lt;/a&gt; on how to integrate Binged with your Ruby on Rails application.&lt;/p&gt;
&lt;p&gt;Creative Commons:&lt;br /&gt;
&lt;a href="http://www.flickr.com/photos/chrisjohnbeckett/"&gt;http://www.flickr.com/photos/chrisjohnbeckett/&lt;/a&gt; / &lt;a href="http://creativecommons.org/licenses/by-nc-nd/2.0/"&gt;CC BY-NC-ND 2.0&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/QG6-HsfmLco" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/03/outsource-your-site-wide-search-with-binged</feedburner:origLink></item>
    <item>
      <title>How to clean up your ActiveRecord migrations</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/8KYbW5ebPwc/how-to-clean-up-your-activerecord-migrations</link>
      <pubDate>Thu, 18 Feb 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/02/how-to-clean-up-your-activerecord-migrations</guid>
      <description>&lt;p&gt;Migrations in Ruby on Rails allow you to alter your database using a convenient and easy &lt;span class="caps"&gt;DSL&lt;/span&gt;.  When I started using Rails, migrations were a breath of fresh air. Database schema were finally easy. No longer did I have to pass &lt;span class="caps"&gt;SQL&lt;/span&gt; scripts to developers to run against their development DB or make a huge script to run at deployment. Migrations took care of this. However the problem with migrations is that after a while, a huge amount of migration files build up in your project. Below are detailed steps on how to clean up your migrations to make managing them easier.&lt;/p&gt;
&lt;h3&gt;Step 1: Ensure you include db/schema.rb in your &lt;span class="caps"&gt;SCM&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;The file &lt;code&gt;db/schema.rb&lt;/code&gt; is the current definition of your database. It is versioned and updated after a migration is run. This file is essential in creating your database once all your older migrations are gone. Remember that &lt;code&gt;db/schema.rb&lt;/code&gt; is db agnostic, so any implementation specific db statements in your migrations will not exist in the schema.&lt;/p&gt;
&lt;h3&gt;Step 2: Migrate to the latest version&lt;/h3&gt;
&lt;p&gt;Notify your team to checkout the latest version of your project and migrate. This will ensure that future migrations will continue to run smoothly on their current development database.&lt;/p&gt;
&lt;h3&gt;Step 3: Seed your database with db/seeds.rb&lt;/h3&gt;
&lt;p&gt;Go through each of your migrations and ensure that no data is being inserted in any of them. Migrations are only supposed to be used to manipulate the structure of your database, not populate it.  Rails provides a file &lt;code&gt;db/seeds.rb&lt;/code&gt; where you can run ruby code and model creation statements to set all the data required by your application to start.&lt;/p&gt;
&lt;p&gt;Below is an example of a &lt;code&gt;db/seeds.rb&lt;/code&gt; file setting up the users of a system:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;User.create [{ :name =&amp;gt; ‘admin’ }, { :name =&amp;gt; ‘foo’ }, { :name =&amp;gt; ‘bar’ }]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can populate your database with seed data anytime by running rake db:seed. Seeding was added in Ruby on Rails 2.3.4.&lt;/p&gt;
&lt;h3&gt;Step 4:  Keep only latest migrations&lt;/h3&gt;
&lt;p&gt;Go to &lt;code&gt;db/migrate&lt;/code&gt; folder and delete all but your latest migration or move the older migrations to a folder such as &lt;code&gt;db/archieved_migrations&lt;/code&gt;. You will want to keep the last migration as a reference if you need to migrate down.&lt;/p&gt;
&lt;h3&gt;Step 5: Setting up a fresh environment&lt;/h3&gt;
&lt;p&gt;Even though all your migrations are gone except for one, a developer can setup a fresh environment with a development database containing all required data by running one rake task: rake db:setup. This task will create the database, load the entire schema from &lt;code&gt;db/schema.rb&lt;/code&gt;, and then populate the database based on &lt;code&gt;db/seeds.rb&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Creative Commons:&lt;br /&gt;
&lt;a href="http://www.flickr.com/photos/kaiton/"&gt;http://www.flickr.com/photos/kaiton/&lt;/a&gt; / &lt;a href="http://creativecommons.org/licenses/by-sa/2.0/"&gt;CC BY-SA 2.0&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/8KYbW5ebPwc" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/02/how-to-clean-up-your-activerecord-migrations</feedburner:origLink></item>
    <item>
      <title>Riding Ruby on Rails 3: Bundler</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/dvFqZG2q5ac/riding-ruby-on-rails-3-bundler</link>
      <pubDate>Tue, 09 Feb 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/02/riding-ruby-on-rails-3-bundler</guid>
      <description>&lt;p&gt;This week a gift was given to us by the rails core team with the release of the Ruby on Rails 3 beta. To prepare both newcomers and experienced Rails developers, AdventuresInCoding is going to be releasing screencasts and posts about Ruby on Rails 3. Our first screencast is about gem dependency management with &lt;a href="http://github.com/carlhuda/bundler"&gt;Bundler&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;iframe src="http://player.vimeo.com/video/9282967?title=0&amp;amp;byline=0&amp;amp;portrait=0" width="615" height="335" frameborder="0"&gt;&lt;/iframe&gt;&lt;p&gt;An introduction to gem dependency management in Ruby on Rails 3 using bundler&lt;/p&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/dvFqZG2q5ac" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/02/riding-ruby-on-rails-3-bundler</feedburner:origLink></item>
    <item>
      <title>Taking the helm of ruby with Ruby Version Manager</title>
      <link>http://feedproxy.google.com/~r/AdventuresInCoding/~3/ukTqrwLisao/taking-the-helm-of-ruby-with-ruby-version-manager</link>
      <pubDate>Mon, 08 Feb 2010 00:00:00 +0000</pubDate>
      <author>Kevin Faustino</author>
      <guid isPermaLink="false">http://adventuresincoding.com/2010/02/taking-the-helm-of-ruby-with-ruby-version-manager</guid>
      <description>&lt;p&gt;&lt;a href="http://rvm.beginrescueend.com/(RVM)"&gt;Ruby Version Manager&lt;/a&gt; the name says it all. The sole purpose of this gem is to mange which version of ruby your system is currently utilizing. The days of creating symbolic links to different installations of ruby are over. With a single command, &lt;span class="caps"&gt;RVM&lt;/span&gt; will change the version of ruby and its gems for your entire user profile.&lt;/p&gt;
&lt;p&gt;Developers using Mac OS X can start using ruby the moment they boot up their machine for the first time. In fact, the latest version of Mac OS X Snow Leopard ships with ruby 1.8.7 &lt;span class="caps"&gt;MRI&lt;/span&gt; patch level 77. The problem with system versions such as the one bundled with Mac OS X is that they stagnate, causing developers to miss out on the latest patches applied to ruby. For example. my current default version of ruby is 1.8.7 &lt;span class="caps"&gt;MRI&lt;/span&gt; patch level 248.&lt;/p&gt;
&lt;p&gt;Besides the benefits of patches, why would a developer with a default version of ruby care about managing it? According to a recent report by &lt;a href="http://railslab.newrelic.com/2010/01/07/state-of-the-stack-a-ruby-on-rails-benchmarking-report-7-january-2010"&gt;New Relic&lt;/a&gt;, 63.5% of all deployments use ruby 1.8.6 &lt;span class="caps"&gt;MRI&lt;/span&gt;. This indicates that a large portion of the ruby community does not want to make the jump to higher version numbers. &lt;span class="caps"&gt;RVM&lt;/span&gt; provides you the tools to test, benchmark and switch your ruby versions with minimal effort. Before &lt;span class="caps"&gt;RVM&lt;/span&gt;, you would have had to compile which version of ruby you wanted, manage the symlink to it and update the &lt;span class="caps"&gt;PATH&lt;/span&gt; environment variable.  If you wanted another version installed, you would have to link it to another name such as ruby19.&lt;/p&gt;
&lt;h3&gt;Installing &lt;span class="caps"&gt;RVM&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;Before installing &lt;span class="caps"&gt;RVM&lt;/span&gt;, make sure you have the latest Xcode developer tools installed as you will experience compilation issues with certain gems if you do not. Mongrel for example will not compile its native extensions without the latest Xcode developer tools.&lt;/p&gt;
&lt;p&gt;To get started, you must first install the gem:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo gem install rvm&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once  installed, initialize the &lt;span class="caps"&gt;RVM&lt;/span&gt; installation and follow all prompts:&lt;/p&gt;
&lt;p&gt;rvm-install&lt;br /&gt;
Finally, install any version of ruby you would like to use, in this case the latest version of 1.8.7 &lt;span class="caps"&gt;MRI&lt;/span&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm install 1.8.7&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Switching Between Ruby Versions&lt;/h3&gt;
&lt;p&gt;To switch between versions of ruby, pass the use action to &lt;span class="caps"&gt;RVM&lt;/span&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm use 1.9.1
rvm use 1.9.1-p378&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="caps"&gt;RVM&lt;/span&gt; allows you to set a default version via the –default flag to easily switch to the version of ruby you use most:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm 1.8.7 --default
rvm default&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you ever feel the need to use the original system version of ruby, &lt;span class="caps"&gt;RVM&lt;/span&gt; allows switching via the system action:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm system&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Installing Gems&lt;/h3&gt;
&lt;p&gt;All gems are installed in their own gem directory for each version of ruby. You would install gems with &lt;span class="caps"&gt;RVM&lt;/span&gt; the same way you do now, except you do not prefix sudo to the gem command. &lt;span class="caps"&gt;RVM&lt;/span&gt; runs under your user profile. By running sudo, you are telling the system to run as the root user which does not have your &lt;span class="caps"&gt;RVM&lt;/span&gt; setup.&lt;/p&gt;
&lt;p&gt;Example, install the rails gem:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gem install rails&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="caps"&gt;RVM&lt;/span&gt; also allows installation of gems on multiple versions of ruby:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm 1.8.7,1.9.1 gem install rails&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;&lt;span class="caps"&gt;RVM&lt;/span&gt; Configuration&lt;/h3&gt;
&lt;p&gt;To set common flags when compiling ruby gems, &lt;span class="caps"&gt;RVM&lt;/span&gt;  allows settings to be placed in a rvmrc file.&lt;/p&gt;
&lt;p&gt;Here are the contents of my ~/.rvmrc file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm_archflags="-arch x86_64"&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;MySQL Gem&lt;/h3&gt;
&lt;p&gt;Some gems require flags such as the MySQL gem. To install the MySQL gem make sure you have set rvm_archflags in your rvmrc file.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;The Benefits&lt;/h3&gt;
&lt;p&gt;Besides the benefit of being able to experiment with any ruby interpreter and version, &lt;span class="caps"&gt;RVM&lt;/span&gt; has a few killer features as well. For example, &lt;span class="caps"&gt;RVM&lt;/span&gt; allows the execution of ruby programs and rake tasks across all of your ruby versions, which ensures backwards compatibility and future proofing of your ruby gems, applications, etc.&lt;/p&gt;
&lt;p&gt;To run a ruby program against all installed ruby interpreters, use the ruby action:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm ruby hello_world.rb&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As with most actions, the ruby action can be restricted to a few versions:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm ruby 1.8.7,jruby hello_word.rb&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The feature I use most often is the ability to run your rake tasks across all interpreters. This is done via the rake action.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm rake spec&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Running the above command runs all of your specs across the installed interpreters. Since running your specs is a common task, &lt;span class="caps"&gt;RVM&lt;/span&gt; provides a shortcut:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm specs&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finally, with minimal effort, &lt;span class="caps"&gt;RVM&lt;/span&gt; can help you learn how fast your code will run under each ruby version through the benchmark action.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm benchmark hello_world.rb&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ruby Version Manager is an amazing project by &lt;a href="http://github.com/wayneeseguin"&gt;Wayne E. Seguin&lt;/a&gt;. It is an essential tool for gem authors and any ruby developer who has to maintain applications across multiple versions of ruby. I have been using &lt;span class="caps"&gt;RVM&lt;/span&gt; for over 6 months and it has made managing ruby a pleasure.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AdventuresInCoding/~4/ukTqrwLisao" height="1" width="1"/&gt;</description>
    <feedburner:origLink>http://adventuresincoding.com/2010/02/taking-the-helm-of-ruby-with-ruby-version-manager</feedburner:origLink></item>
  </channel>
</rss>

