Rails' Next Top Model: Using ActiveModel and ActiveRelation

Adam Keys (Gowalla)
Location: Ballroom I
Average rating: ***..
(3.48, 67 ratings)

Rails jumped on the scene five years ago in part due to excellent support for connecting database tables to Ruby classes via ActiveRecord. Rails 3 makes two major improvements to this support. ActiveModel makes it easy to turn any old object into one that looks like ActiveRecord to your Rails app. ActiveRelation makes many kinds of queries easier and makes it possible to write some queries that were very difficult in the past.

In this talk, we’ll learn how to build our own model layer using ActiveRelation and ActiveModel. We’ll start by learning how ARel works and how to use it. Then we’ll write an adapter for our own database. Next, we’ll see what ActiveModel provides and how we use it through ActiveRecord. With this in mind, we’ll add functionality to our models that make them look just like ActiveRecord to our Rails app.

In the end, we’ll have a good grasp on the new options for modeling data in Rails 3 and how we can use that to write cleaner apps.

Photo of Adam Keys

Adam Keys


Adam Keys is a software developer, entertainer and lover of animals. He’s written software in too many languages to name at startups, small businesses and Fortune 100 giants. His philosophy of coding is to write less code and have more fun writing it.

Outside of software development, Adam has studied double bass performance, performed standup comedy and written comedy sketches. He and his wife volunteer for Central Texas Dachshund Rescue and reside in Dallas, Texas, with 3 dachshunds and 2 tabby cats.

co-presented by Ruby Central, Inc. O'Reilly
  • Engine Yard
  • Heroku
  • 8th Light
  • Blue Box Group
  • InfoEther
  • JetBrains
  • New Relic
  • Open Hosting
  • Rhomobile
  • WyeWorks
  • Linux Pro Magazine
  • Chargify

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at RailsConf, contact Yvonne Romaine at yromaine@oreilly.com.

Download the RailsConf Sponsor/Exhibitor Prospectus

Media Partner Opportunities

For information on trade opportunities with O'Reilly conferences or contact mediapartners@ oreilly.com

Program Ideas

Send us your suggestions for speakers, topics, and activities to rails-idea@oreilly.com.

Press and Media

For media-related inquiries, contact Maureen Jennings at maureen@oreilly.com.

RailsConf Newsletter

To stay abreast of conference news please sign up for the RailsConf newsletter (login required)

Contact Us

View a complete list of RailsConf 2010 contacts.