Rails 1.1: Loaded with 37s extractions David 28 Mar 2006

23 comments Latest by Rugby Fan Steve

Rails 1.1 is alive. It's a huge update, the biggest yet, with more than 500 fixes, tweaks, and features from over 100 contributors. It's also a triumph of extractions. Most of the blockbuster features started life in 37signals applications. A rundown:

  • RJS - JavaScript written in Ruby: We initially extracted the Ajax support in Rails from Backpack. It was the first application that I used the send-HTML-instead-of-data approach to Ajax, which became the foundation for the update mechanism in Prototype. But as we increased our appetite for Ajax with Campfire, we needed more. RJS was extracted from the work to make all the JavaScript code in Campfire beautiful.
  • Polymorphic associations/join models: Sunrise gave birth to both of these features as I needed to implement rich tagging against multiple classes (you can tag people, companies, entries, etc with the same tags). This an example of us sharing new features even before the founding application has launched.
  • Accept-driven responses: The new Basecamp API is based upon the work I did when discovering usefulness of the accept header in HTTP and working with Jamis to built a great way to encapsulate that. Now we can have the same code easily serve Ajax-calls, API-calls, mobile clients, and more.
  • ActiveRecord::Base.to_xml: When creating APIs, you usually have to expose tons of model objects as XML (like give me all the todo items for this list in XML). Marking all this XML up by hand every time is tedious. We needed something better to stay productive for the Basecamp API, so to_xml was born.
  • Integration testing: Testing Campfire properly required more than Rails initially provided. How do you verify that things are working right when two or three people are chatting simultaneously? With integration testing that's easy as you can run concurrent sessions and make assertions about the interactions. Jamis extracted this from Campfire and did a great job writing about how to use it.
  • Enumerable#group_by and Array#in_groups_of: How to easily partition data into chunks for presentation? These two methods were born from Campfire's transcript browser by Marcel and Sam.
  • form_for, form_remote_for, and fields_for: Most of the form helpers in Rails was based around the notion that you would only have 1 form per object type per page. Sunrise quickly brought that to same with many forms for similar object types all over the place. So we extracted a new, cleaner way to specify forms and their relationship to models.

Frameworks are extractions. The best ideas arise when you're squeezed between the constraints of time, reality, and a desire to be happy writing beautiful code. There was no way we could have come up with all of these new features by simply contemplating what some people might need some day.

Designing software by guessing about the future is a terrible way to arrive at something pleasant.

23 comments so far (Jump to latest)

Keeran 28 Mar 06

An awesome update, and a brilliant exercise in Buzz generation…certainly the first time I’ve heard the Sunrise title ;)

Thanks a lot David, the core, the contributors and 37s - loving it all and can’t wait to deploy my own creations made with your tools.


Piotr Usewicz 28 Mar 06

I don’t think that any good framework was born just from an IDEA. Most of successive ones were written, no extracted, just like Rails.

Danny Cohen 28 Mar 06

This is Amazoing´┐Ż and stunning work. It seems quite selfless on the part of 37s to just let everyone has their hands at the great extractions.

I can’t wait to jump in and start tagging everything in sight. This makes that Rails Recipe book looking more enticing right now.

Steve 28 Mar 06

Great job guys. I am rapidly moving my php stuff to RoR. I am glad to see you guys taking the lead.


Tell me more please!

Ted 28 Mar 06

I haven’t had a chance yet to play much with Rails, but it’s statements like, “Frameworks are extractions” that give me a lot of optimism!

Tom 28 Mar 06

Fantastic! I’m definitely looking forwards to playing with polymorphic associations. I’ve had edge Rails for a while, and I’ve really enjoyed RJS and form_for. They are incredibly useful.

Thanks guys, and everyone on Rails core.

Nick 28 Mar 06

For Sunrise comment see here:http://www.37signals.com/svn/archives2/sunrise_37signals_crm_tool_for_small_business_is_coming_soon.php

Cool work guys!

The Gimp 28 Mar 06

Great job as allways guys! I’m looking forward to giving 1.1 a try. I just launched a new ecommerce site and really could have used the new chainable events. Time for a update!

Pius 28 Mar 06

I definitely plan to upgrade … thanks for the amazing work!

Anonymous Coward 28 Mar 06

Awesome. The javascript generator is god sent. It’s so awesome to be able to take that ajax stuff out of the helpers and views!

Hank 28 Mar 06


I don’t want to get too off topic but now after reading “Getting Real” and listening to your SXSW talk, do you have any thoughts on Facebook.com turning down $750 million because they want $2 billion instead.


My initial thought would be for them to realize that $750 is a very respectible offer and to cash out now (especially since the founder is only 21-22 years old)

JF 28 Mar 06

I have no idea. If the founder wants to hold out for 2 billion, good for him. If he holds out too long and misses another deal, bad for him. That’s his choice. I don’t know him or his business or what his goals are so I don’t have any comments on the actual deal itself.

Rabbit 28 Mar 06

I’ll throw my 2 cents in.

The guy’s an idiot.

750 million not enough? Puh-lease. There are people starving all around the world and you want to hold out because _you_ think your pet project is worth more.

What a joke.

I’d love to slap that guy.

JF 28 Mar 06

Rabbit, there are a lot of people around the world that think *your* salary is *insane* too. And they’d love to slap you in the face when you ask for your next raise.

So it’s all relative. Everyone has their own number.

Michael Ward 29 Mar 06

Rabbit: If the owner thinks he can keep hold of his company and make $2 billion over the next 5 years, then why should he want to sell now for $750k? If you beleive you can make that kind of money, then what is the point of gifting that money to other people? The $2billion is probably an over-valuation, but then that is how negotiation works.

Of course, he could be greedy and blind to the deal he is getting. But then that is his problem.

Darrel 29 Mar 06

“If the owner thinks he can keep hold of his company and make $2 billion”

Has any web site sold for 2 billion? That’s kind of nuts. If he can sell it for that, then we WILL know bubble 2.0 is about to pop. ;o)

Andrea 29 Mar 06

A polymorphism explanation: http://www.kuro5hin.org/story/2006/3/14/175929/544

Have fun!