Jon Leighton


I'm looking for work in Melbourne! »

23 March 2018

I’ve just moved from the UK to my partner’s home town of Melbourne, Australia and I’m starting to look for programming work here.

My first steps contributing to Servo (and learning Rust) »

28 January 2018

I remember first learning about web technologies as a teenager. This was back in the days when the majority of websites still used tables for layout, and a “standards based” approach was just starting to gain popularity. The CSS Zen Garden was in vogue.

Principles for deciding what to work on »

4 May 2017

Towards the end of last year I bowed out of a four and a half year stint as Loco2’s Technical Director. Doing so forced me to consider, for the first time in a while, what it is that I really want to do in my working life.

Square pegs, round holes, and Rails' directory structure »

16 March 2017

Where should you put code in your Rails application? Often, the answer is obvious: models go in app/models/, controllers go in app/controllers/, and so on.

Overhauling Loco2's hosting infrastructure with AWS, Docker and Terraform »

16 December 2016

Recently I worked on a major overhaul of the infrastructure hosting In this post, I’ll dig into the details of what we did and why.

Revocable sessions with Devise »

10 October 2013

By default, session data in Rails is stored via a cookie in the user’s browser. It’s a nice, simple storage mechanism, but it means that the server has absolutely no “memory” of a given session. This can cause security problems for your application.

Poltergeist 1.0! »

7 October 2012

Almost a year ago, on a complete whim, I decided to try to hook up the headless browser PhantomJS with Ruby’s full-stack acceptance testing framework, Capybara.

Explaining Focused Controller »

20 September 2012

Controllers in Rails are a problem. Actions sometimes become unmanageably long, and it’s often difficult to know how to test them when you need it most. At Railsberry in May, I presented a new way of writing controllers.

Rails controllers and OOP »

20 April 2012

Rails controllers violate the Single Responsibility Principle. Each “action” has a different responsibility and should be contained in a separate object. Controllers are also hard to unit test, so we end up using slow “functional tests”.

Poltergeist 0.6.0: Javascript error handling and remote debugging »

15 April 2012

Recently I pushed version 0.6.0 of Poltergeist. This version brings some pretty awesome features that I am very excited about.

Tracking down method definitions in Ruby »

19 February 2012

One of my favourite features of Ruby 1.9 is the #source_location method of Proc and Method. Let me explain. Often I am confronted with a large code base (usually Rails), and want to figure out exactly where some method on some object is defined. Rails has many dark corners, and sometimes finding things isn’t entirely straightforward.

How to prevent Ruby's test/unit library from autorunning your tests »

19 February 2012

Today I had a situation where I wanted to use perftools.rb to profile a test suite, which was written with Ruby’s test/unit library.

Hashes and encapsulation »

9 January 2012

Earlier today I made an off-the-cuff remark about encapsulation on twitter.

Poltergeist: A PhantomJS driver for Capybara »

3 January 2012

This announcement is coming way later than I had originally intended. Last October I started experimenting with the idea of writing a driver for Capybara that would use PhantomJS as the browser.

initialize_clone, initialize_dup and initialize_copy in Ruby »

30 August 2011

Ruby has two methods for creating shallow copies of objects:

Mass assignment security shouldn't happen in the model »

14 August 2011

Mass assignment security is a feature in Active Model (and therefore Active Record) which allows you to be selective about what input you will accept when ‘mass assigning’ a hash of attributes.

How to write an awesome Active Record bug report »

10 July 2011

The main area of Ruby on Rails that I work on is Active Record. As such, I see a lot of bug reports for Active Record. This article will be about how to submit a good bug report to help people like me (Rails committers) help people like you (bug inflicted developers).