~/talk

An Intervention for ActiveRecord

Talkat RailsConf 2013 · 2013-04-29..05-02· [ruby-on-rails]
slides:none on file

ActiveRecord contains real, concrete warts: ~16,000 lines, hundreds of methods and surprising behaviors you must know before you touch models. Expect specifics: init_with/instantiate bypasses initialize so hydrated records differ from new ones; associations sometimes auto-persist depending on persisted state; predicate_builder forces known table names which breaks dynamic joins; inverse_of fixes object identity and prevents validation surprises. Practical fixes and tools discussed include squeal, ransack, meta_where and rescuing DB unique-constraint errors instead of trusts in validates_uniqueness_of.

AI-written summary · about

  1. 0:00Start
  2. 2:48Active Record has the primary advantage of simplicity. It's easy to build Active Records, and they are easy to understand.
  3. 3:0057 ancestors 559 class methods 352 instance methods
  4. 3:50ActiveRecord has issues
  5. 4:08NOBODY UNDERSTANDS ACTIVERECORD
  6. 4:32YOU ARE NOT THE EXCEPTION
  7. 5:52MAGIC REQUIRES CONVENTIONS
  8. 6:26OBJECT INITIALIZATION
  9. 19:17VALIDATES UNIQUENESS OF
  10. 23:35DEFAULT SCOPE
  11. 36:14INHERITANCE AND SUPER
  12. 38:06ACTIVERECORD WORKS WELL ENOUGH
  13. 38:23INTENTIONALLY
  14. 39:24ACTIVERECORD IS LEGACY
  15. 39:35ACTIVERECORD IS OUR LEGACY
  16. 40:20PARTICIPATE IN THE DISCUSSION
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.