Rails Conf 2010 Tutorial Day

08 Jun 2010

Here I am at Rails Conf 2010 in scenic Baltimore, MD and these are my thoughts on the tutorial day.

The Rails 3 Ropes Course - Gregg Pollack and his band of minions (Nathaniel Bibler, Thomas Meeks, Jacob Swanner, Tyler Hunt, Mark Kendall, and Caike Souza)
The worst thing about this presentation is that is was so informative, slick, and well paced that it spoiled me for the afternoon session – But more on that later. Gregg et al. took on an ambitious task and knocked it out of the park. They discussed a number of new things in Rails 3 and had 5 labs to work through. Every time I was just about done with my lab time was just about up and we moved on. Speaking as a former teacher, that is damn hard to do.

Details:
When setting up a Rails 3 app you can do some interesting things like skip active record, or test unit, or git (What? By default Rails 3 will create an intelligent .gitignore file for you as every Rails developer uses Git (heh)). You can do things like this because of the increased modularity of Rails 3.

The new routes syntax is fun:

You can add constrains like so:
:constraints => {:user_agent => /iphone/}

In Rails 3, Bundler is used to manage gems. I’ve used bundler in a few production apps now and I’m totally in love with it. Bundler does what config.gem was supposed to in an easy and awesome way. And you can use it in 2.3.5! Bundler Rulez! OK, I’ll stop now.

ActionMailer now extends from AbstractController.

O.
M.
G.

Now mailers aren’t this weird other world that’s kinda like a model but kinda like a controller. It uses the same underlying code as the controllers. This is a long needed refractor that has enabled better syntax and less confusion.

ActiveRelation is the new bad-ass relational algebra querying syntax where you can do cool stuff like:
Post.where(:author => “Joe”).include(:comments).order(:title).limit(10)

To sum up ActiveModel, all of these things that used to be tightly coupled with ActiveRecord:

Are not anymore and you can use them in ordinal Ruby objects just by including a mixin. Sweet.

Rails 3 assumes any string is an XSS (Cross Site Scripting) attack unless you tell it otherwise and escapes it. To output html in a view, you’ll need to use the ‘raw’ method.

Unobtrusive JS is now used in all the view helpers so if you’ve ever felt bad about using :confirm => “Are you sure?” but did it anyway because it was just so easy, you can put down that bit of guilt as it all reference a proper Javascript file and with no inline JS.

Rails 3 truly is ponies and rainbows.

Rails 3 Deep Dive - Jeremy McAnally

Tweet from Jeremy McAnally (@jm) 2 days before Rails Conf: “Why wouldn’t I catch the flu right before RailsConf where I’m supposed to talk in front of people for a few hours? *sigh* Vitamin-C, engage!”

So the first 10 minutes were about how Rails 3 is basically a Rack app. And then, all of a sudden, we were in a lab. He gave us 3 possible things to build with either Rack or Sinatra. With no explanation of how to do so… So I started to google for Rack docs, but 2 thoughts occurred to me:
1. I could google on my own time.
2. This does not bode well for the rest of the talk.

So I bailed. It could have gotten awesome after that, but the tweets were not kind.

I ended up at:

Contributing to OSS - The 8 Steps for Fixing Other People’s Code - Dr Nic Williams

Which was… Well right after I showed up he had a ‘lab’ where you were supposed to meet people until you ran into a foreigner. In a way it was valid to have us meet people as open source is all about collaboration. In another, much more real, way it seemed like he was trying to pad a short presentation. He encouraged us to find an open source project an write a ‘how to contribute’ section for it because almost none of them have one. I then realized that metric_fu doesn’t have such a section and wrote one. After that there was some floundering around with git and everyone trying to use the wireless at the same time. I wandered away.

And into an awesome discussion at BOHconf (an open spaces, or ‘un-conference’ that is running concurrently with Rails Conf at the Baltimore conference center) about fast tests. I got way more out of that half hour than the previous 3 hours combined.

Things I’m planning on looking into:

Things that came up which I hardily recommend:

Somewhere in there Nick Gauthier declared: “I love making test suites faster. Tell anyone who wants to come by BOHconf and I will make their test suite faster.” Take him up on it is my advice.

And then it was time for steak and rum.