~/talk

Revealing Rails Magic with Enums

links:none on file
slides:none on file

Breaks ActiveRecord enums into concrete steps: how enum attributes map to integer columns (zero-based), how to add them with rails generate migration, and how Rails turns an array or hash into integer mappings, dynamic predicate (!) and bang (!) instance methods, and class scopes by generating method names. Shows console demos (Meeting, Car, Prescription), warns that changing enum order breaks DB mapping, explains prefix/suffix and options to disable scopes or instance methods, and rails console examples and reads Rails source on GitHub to trace the implementation.

AI-written summary · about

  1. 0:00Introduction to Rails enums
  2. 4:50What is an enum in Rails
  3. 8:27Using enums in Rails models
  4. 12:57Enum prefixes and suffixes
  5. 15:17Enum scopes in Rails
  6. 16:21How Rails enums work under the hood
  7. 18:57Exploring Rails source code
  8. 28:26Conclusion and resources
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.