Posts by author:

Note: These instructions are for Mac OS 10.4. I don’t know if they’ll work with Leopard.

Installing git is easy, just compile from the source. Git svn is harder to install because it is a bunch of perl scripts that needs the svn perl bindings (it comes with git btw). Here are the steps I recommend to make sure everything works.

First, we’ll install git using Macports. This will take care of installing all the required perl libraries:

$ sudo port install git-core +svn

However, macports installs a slightly old version of git. So I suggest downloading the latest and compiling from source.

$ sudo make install
 # Note: watch out for the way your PATH is setup
 # to make sure you are using this new git version
 # instead of the macports version
$ git --version

Now if you try to run git svn, you might get an error about it not finding SVN/ That means your version of subversion does not include the perl bindings (which is the standard if you installed svn with macports). I suggest you install subversion from this package that includes the language bindings. Now you need to add this to your ~/.profile:

export PERL5LIB=/usr/local/lib/svn-perl

Everything should work. Now it’s time to import your svn repositories and enjoy git.

Popularity: 58% [?]


I’ve been using git for three months now and it has had zero impact on my team. They weren’t even aware I was using it for the first few weeks. That means, you can start using it now, for your personal development, without having to convince anybody.

Git comes with a svn wrapper. You can import your svn repository to a local git repository. You then get all the advantages of git: easy branching/merging, offline operation(very useful if you work with a laptop), etc.

$ git svn clone http://path/to/svn -T trunk -t tags -b branches

This command will import all the revisions from svn and create branches in your git repository (one for trunk, and one for all your branches). You will be on a branch master (linked to trunk) and can start working. You commit normally to your repository.

When you are ready to send your changes back to svn:

$ git svn rebase # (equivalent to svn update)
$ git svn dcommit # (equivalent to svn commit)

Rebase works by reverting your changes, getting the latest revisions from svn, and then reapplying your changes. You resolve any conflicts (if there any). The last command then pushes your changes to svn for your team to enjoy.

Those are the three commands you need to know to use git with svn.


Svn:externals are not supported. I suggest you use piston to handle them.

Check out the git svn docs for a few more things to watch out for.


Now that your team has seen you using git successfully for weeks, it will be much easier to get them to switch!

Popularity: 21% [?]


Rails developers will switch to Git because just like Rails is ten times better than any java( or .Net) framework, git is ten times better than subversion.

I will be presenting git at the next Montreal On Rails. You may want to wait for my presentation to switch to git, but that means going a whole month without benefitting from git’s awesomeness. So here are a couple of links to get you started:

That should be enough to get you started. Make sure you listen to Linus’ talk. It’s one hour long, but it’s definitely worth it.

Popularity: 26% [?]


Deployment, deployment, deployment. Ok not three, but just two awesome presentations on deployment.

Carl Mercier, Rails Deployment Option

Carl compared the different hosting solutions available for Rails. You want to avoid shared hosting and start with a Virtual Private Server(VPS) so you get enough RAM to run a couple of mongrels. Carl has had good experiences with Slicehost. A dedicated server is the next step if you need more power, but you might want to skip it and go directly to the next option.

Amazon EC2. The game changer. Take all the advantages of server virtualization and add on demand power when you need to scale. Check out EC2 on Rails. It contains a complete image already setup for rails. Also check out Rightscale. They have a nice dashboard to help you manage your instances.

Mehdi Adda, Setting Up Your Server

Mehdi showed how to setup mongrel+nginx+seesaw+monit. Mongrel acts as the app server. Nginx is a lightweight and fast web server. Seesaw allows you to restart your mongrel cluster with no down time and always only one version of your app running. Monit supervises your processes and can kill them if they have a problem, restart them if they crash or send you a warning email if you’re running out of disk space.

Check out Mehdi’s slides. They are very thorough on the steps to setup each part. You can get the slides on the Montreal On Rails website.

Next edition

The next is scheduled for the middle of January. I’m wondering if people would be interested in a presentation on git. It is not strictly rails related, but should be of interest to all rails developer. I’ve been using it for almost three months and it rocks. In fact, I’m going to make a prediction: 80% of all rails developer will switch to git before the end of 2008.

Popularity: 25% [?]


Dan Webb has very very interesting presentation called Metaprogramming Javascript. I think it’s the most simple and understandable explanation of how the diffferent javascript frameworks extend javascript. It takes five minutes to go through and you gain a better appreciation of javascript’s simplicity and power.

Here is another presentation to put your new knowledge to test that builds a small DSL for working with forms that allows for something like this: show(“province-field”).when(“country”).is(“Canada”).

Popularity: 9% [?]


This has to be one of the best analogies to explain software reuse.

Popularity: 8% [?]


Yet another great Montreal On Rails last night, again at the Standout Jobs office.

JRuby on and off Rails, by Mathieu Martin

JRuby is an interesting project in many regards. Whether you already have a huge investments in Java, need one of its many libraries, want a faster VM (not for long), prefer to write a performance sensitive part of your app in Java over C, JRuby has something for you.

It can be tough to follow the development of JRuby and Mathieu did a great job of bringing everyone up to speed on the current state of JRuby and where it’s going. I learned that even C libraries will soon be usable (they just need a small wrapper.)

There remains some small compatibility issues between JRuby and the official ruby, so you need to test your app to see if everything is working for you.

The only thing that bugs me is when I hear that deployment is easier. I don’t think copying a war file is easier than running cap deploy. Yes you have to make your cap recipe and configure your server, but I hear that this is still easier than installing something like Tomcat.

acts_as_state_machine, Alain Pilon

acts_as_state_machine is a great little plugin that more people should know about. Finite state machines are very useful to model lots of thing. The plugin provides a way to define states, events that change the state and actions when that happens. FSM are simple to understand and simple to verify their correctness.

Comatose, Sylvain Carle

Comatose is another nifty plugin that gives you basic Content Management System(CMS) functionality (create, edit pages and history of modifications). Sylvain Carle explained how to use it and how easily they integrated it for the Praized Media website and in another of their projects in two days.

Popularity: 11% [?]


The problem:

Having logic in your view is bad. Putting some in the helpers can help. Some methods can be put on the model. Sometimes, your view involves a couple of models, the helpers get bigger, you’re not sure on which model to put a method as it needs data on a few of the associations. The view is getting ugly, you have to go through pages of helper methods to find things. You’re feeling dirty.

The solution:

Move all the methods related to one of the view to a class (the presenter). Create it in the controller by passing it all the objects it needs to manipulate. Change your view to only call methods on your @presenter.


You will probably want to have access to the ActionView::Helpers::* in your presenter so it can useful to declare a base presenter class you will inherit from like this:

class Presenter
  include ActionView::Helpers::TagHelper
  include ActionView::Helpers::FormHelper
  include ActionView::Helpers::FormTagHelper
  include ActionView::Helpers::FormOptionsHelper
  include ActionView::Helpers::DateHelper
  include ActionView::Helpers::JavascriptHelper
  include ActionView::Helpers::AssetTagHelper

  def intialize(controller)
    @controller = controller

Some helpers need the @controller to do their magic.

Success stories:

I’ve used this approach two times now. Last time, I had a view that showed deeply nested data (parent => children => children => children). There were a bunch a checkboxes that needed to be all checked/unchecked at the same time depending on which element was clicked. Putting all the methods required to generate the checkboxes with ids and class and restoring that from the params in case of an error was ugly. However, that ugliness was nicely sealed in a class that prevented infection of the rest of the code.

Further links:


The approach I described here may not fit the original presenter pattern as described in those other links. What’s important here is, if your view is getting ugly, hard to test, you have too many helpers, or the code is starting to smell, you can move stuff to a new class. This may seem evident, but I sometimes feel people using rails forget that you can do stuff “outside” of the way rails normally structure a project. Also note that the presenter pattern is definitely not something you need for every project.

Popularity: 10% [?]


Last night’s Montreal on Rails was once again a fun event with three great presentations. Standout Jobs hosted the event in their new offices (quite nice btw).

Gary Haran on Prototype

Gary gave a very interesting tutorial on the basics of using the Prototype javascript framework. I learned quite a few things. Prototype’s doc seems to have really improved in the last year and I should probably learn it, instead of living in fear of writing javascript. Someone mentioned that prototype modifies directly some standard classes and can break other libraries. It’s something you should be aware of.

I would like to see a followup to this presentation, with more advanced prototype stuff and a how to properly write a class.

Francois Beausoleil on Piston

Francois is the author of Piston and presented it in a very succinct way. It’s a tool to help you manage your svn:externals (you probably have a few in your plugin directory). I like it: simple tool that solves a very real problem (breaking your deployment because a remote repository is down).

James Golick on make_resourceful and shoulda

James presented two useful plugins. make_resourceful is like dynamic scaffold for restful controllers on crack. It has a whole bunch of callbacks and things to override to easily customize parts of the controller. shoulda provides lots of test helpers, helpers for validation, model association and restful controllers. That last one is a really nice complement to make_resourceful.


Montreal on Rails is a great initiative. It’s great for the presentation, the networking and it’s gonna help the raise the level of expertise of everyone involved. I heard lots of people talking how they started using things they heard about in past presentations. There’s so many plugin out there today (there’s almost too many) that every edition should have a 15 mins presentation where someone presents 2-3 plugins. See you all next time!

Popularity: 13% [?]


One of the best books I’ve read about design is Domain Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans. InfoQ has a small ebook called Domain Driven Design Quickly that provides a nice summary of the book. It was a good refresher for me as I read DDD about three years ago.

So What is Domain Driven Design? Read the link to have a good overview. Here are the two most important points:

  • Focus on modeling the domain and domain logic of your application.
  • Build a “Ubiquitous Language” that is used by all the team (from domain experts to analysts to developpers).

The most interesting part of the book for me was the patterns presented as the basic building blocks of a model-driven design: Layered Architecture, Entities, Value Objects, Services, Modules, Aggregates, Factories, Repositories. These are all very simple but fundamental patterns in software development. These are types of objects that are present in all designs. Understanding the difference between a value object and an entity is crucial and can help simplify a design.

The book also discusses the importance of iterative design, the importance of incorporating back what you learned about the domain in the model as you iterate and how to preserve the integrity of the model. There is a good discussion of ways of separating the model as the team gets bigger.

The value of this book for a Rails developer

Ever heard about skinny controller, fat model? This is THE book about building a rich model.

However, it really depends on the type of application you’re building. Most Rails application are mostly concerned about CRUD operations without too much logic behind. You won’t get out much from this book.

But if you’re working on a business app with a lot of business logic, then this is a must-read.

The ebook also has a small interview with the author. He highlights the expressiveness of ruby and mentions that DSLs are probably the next big step in Domain Driven Design.

Popularity: 44% [?]