RailsConf Talk Proposal

This year I went to RailsConf in Portland Oregon and had a good time, but the whole time I was there I thought I should be doing my own dang presentation.  So I submitted a proposal for the upcoming RailsConf 2008.  For the curious, here is the proposal. Hopefully they’ll bite, because I think everyone walked away from RailsConf 2007 wishing there were more in-depth technical topics discussed.

HyperExtending ActiveRecord Internals

Description

While ActiveRecord gives us so much power right out of the box, it doesn’t have to stop where the Rails core team leaves off. This set of code walkthroughs will explore several production-tested techniques for extending the internal machinery of ActiveRecord to allow richer dynamic finders, scope conditions, association proxies, access-control, and more. Guaranteed to give you real super powers.

Session type: 45 minute conference session

Abstract

I love ActiveRecord. Its an extremely handy set of code that does a lot for me and I’m grateful for it every day. However, as a developer, whenever I get a taste of a good thing, it just makes me hungry for more. What if I could represent associations in my finder conditions? I could get a list of all Customers who had Purchases from the Chicago store with simple finders:

Customer.find(:all,:conditions=>{:purchases=>{:store=>‘Chicago’}})
Customer.find_all_by_purchases_having_store(‘Chicago’)

What if I could declare scopes and chain them together to filter my finder results? I could define a scope using an association between users and their sessions, call it ‘logged_in’, and use it as a filter on an association proxy to find all my friends who are currently logged in:

@user.friends.logged_in.find(:all)

What if I could leverage the elegant combinatorial power of symbolic expressions to represent conditions without the need for embedded SQL in strings? What if I could automatically limit the records retrieved based on a User’s rights? What if I could build a has_many :through that bridged another has_many :through?

I’ll cover how to do all of these using source code walkthroughs and impart some advice and techniques for writing your own ActiveRecord extensions along the way.

Tags: , ,

Leave a Reply