Slides from RailsConf
Posted by Chad Pytel
Jun 02

On Sunday at 1:50 I had the pleasure of giving my talk Advanced Active Record Techniques: Best Practice Refactoring. Thank you to all who gave me the positive feedback afterward, I really appreciate it.
Here are the slides for the presentation.
If you enjoyed this presentation, please recommend me on Working With Rails.
Comments on this post
Jun 03
Trevor Turk said,
Great slides – I wish I could have made it to the presentation (and RailsConf in general, really).
Just a small note – I think you could clean up your final controller action on page 69 a tiny bit more using some new Rails 2.1 goodies – namely, the ability to use blocks with new and create:
http://github.com/rails/rails/commit/dd120ede53eaf71dee76894998a81626b7a689fc#L1R610
You might even be able to squeeze the first 5 lines into 2, if you wanted to go nuts.
Jun 03
Chad Pytel said,
Thanks, Trevor. You’re right, the new block syntax for new and create would have been great to include here.
On a related note, to all who grab the slides and didn’t see the talk – One thing that doesn’t come through in the slides was what I was actually saying while they were up on the screen – and that was that if it were a talk on controllers, I’d refactor everything further.
Perhaps I’ll clean up my slide notes and post a copy of the slides with the notes attached.
Jun 05
Adam Grant said,
Hey Chad,
Great slides! I especially agree with the callback refactoring. It makes things alot easier to read.
I was curious about slide 91, specifically:Shouldn’t that be in the User model, and not the Role model?
If that’s the case, then in terms of it’s use, is the correct call:
@user.roles.admin?
Jun 05
Chad Pytel said,
Yes, that’s correct – the call will be @user.roles.admin?
That was one of the things that I said during the presentation, but that wasn’t included on the slides (it probably should be). I also noted that if you really wanted to have an
has_role?method on user, I’d be ok with that as well, but that this is the way I’d do it.I’m glad you enjoyed the slides.
Sorry, comments are closed for this article.
© 2000 - 2009 by thoughtbot, inc.
written by a bushel of tiny robots
Come “ride the toad” on Hoptoad, the app error app.
Thunder Thimble: Brand monitoring for social media.
Widgetfinger: Simple content management for simple websites.
Tee-Bot, funny shirts your friends won't understand!
Umbrella Today: “It’s like totally the simplest weather report ever, Julie.”
Thoughtbot
thoughtbot is a technology consulting firm that provides web application development and design services. We focus on building modern systems, embracing good ideas and delivering elegant solutions.
Interested in learning Rails?
Sign up for our beginning or advanced training.
Archives