Rails' Next Top Model: Using ActiveModel and ActiveRelation
Rails_ Next Top Model_ Using ActiveModel and ActiveRelation Presentation [PDF]
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.
Adam Keys
Gowalla
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.
















