As Matt Magain pointed out yesterday, Rails 2.0 is now gold! Not a lot has changed feature wise from the PR (makes sense – features were frozen at that point), although it seems that the new improvements to fixtures managed to slip in to the final version.

Rather than having to map foreign keys in your fixtures using id numbers, you can use fixture names, which makes life a whole lot easier. So you can now write:


  id: 1
  first_name: Joe
  last_name: Blogs
  id: 2
  first_name: Mary
  last_name: Smith


  id: 1
  user: joe_blogs
  url: ""

  id: 2
  user: mary_smith
  url: ""

which obviously makes a lot more sense to a human reading it, especially when you have a large number of fixtures across many models.

Let me join Matt in congratulating the Rails core dev team for achieving this milestone – roll on Rails 3!

Myles a Perth-based web developer who has worked in all the major web languages, his weapon of choice being Ruby on Rails—although he’s found himself doing more and more front-end development in JavaScript, HTML, and CSS.

  • Stephen

    Dude, no need for the ids. Those are sooo 1.2.x.

  • Philippe Rathe

    And we can say thanks to John Barnette. He is the author of the previous plugin Rathole ( who do exactly that. And Rails decided to integrate it later.

    Thanks John.

  • hadrien

    this feature have been available for a long time in the symfony php framework, which was inspired from rails.

Special Offer
Free course!

Git into it! Bonus course Introduction to Git is yours when you take up a free 14 day SitePoint Premium trial.