Join us for a two day, double track Ruby conference at the Seaport World Trade Center in Boston, MA!

Oct 12-13, 2013

Sold Out!
Neeraj Singh

Neeraj Singh

Neeraj loves ruby, JavaScript and open source culture. He has contributed to open source projects like RubyOnRails, jQuery-ujs, Spree and ActiveMerchant . He is based in Miami and runs BigBinary, a RubyOnRails consulting firm.

ActiveRecord is still magical

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.