Wicked Good Ruby 2013 - ActiveRecord is Still Magical
1,376 views · Published 30 October 2013 · 41:50 · Indexed 12 November 2026
Channel: Confreaks · 2013 · Science & Technology
By Neeraj Singh ActiveRecord is complex code and because of complexity it has edge cases. In fact lots of edge cases. We will take a look at a number of ActiveRecord features to see how it works and how to deal with some of the edge cases. We will see how default_scope works. And why method "unscoped" removes default_scope from models but not from associations. Do you know the difference between CollectionProxy and Relation ? Do you know why in a has_many through case "@physician.patients.create!" would work but "@physician.patients.where(active: true).create! would silently fail without creating the association record? We will discuss why while patching Active Record you should run your tests against all three databases. Guess which of these two obey :destroy option: @customer.orders.delete(@order) or @customer.orders.destroy(@order). In Rails 3 when where conditions are merged then the last where condition wins. In Rails 4 all the where conditions are 'And'ed. But not defautl_scope. We will see how and why. Will also discuss implementation detail of features like inverse_of, autosave and callbacks. Help us caption & translate this video! http://amara.org/v/FG62/
More from this channel
-
35:52
Code Design and the Science of Pleasure
-
5:40
Services Inception with Ruby by Dave McCrory
-
48:58
Ruby Software Continuously Delivered and Exhaustively Explained by Brian Guthrie, Srushti Ambekallu
-
40:58
Jruby Polyglot Heaven by Thomas E Enebo and Charles Oliver Nutter
-
42:17
Be a Minecraft modman with Purugin by Thomas E. Enebo
-
36:46
Your tests are lying to you by Chris Parsons
-
23:46
KidsRuby: Think Of The Children! by Ron Evans
-
52:05
Resources, For Real This Time (with Webmachine) by Sean Cribbs