Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Reading Rails 1.0 Source Code

Reading Rails 1.0 Source Code

https://rubyonrails.org/world/2025/day-2/masafumi-okura

This deck doesn't include videos which makes it complete. You're supposed to watch the video to enjoy it fully, the url: #{youtube.url_for(my_video)}

Avatar for Masafumi Okura

Masafumi Okura

September 05, 2025
Tweet

More Decks by Masafumi Okura

Other Decks in Programming

Transcript

  1. Dejima As westerners, only Dutch people used to live here

    for trading through Edo Period (1603 ~ 1867). During Edo Period, Japanese people imported western thoughts and techniques from Netherlands.
  2. pretty_print(myself) • Name: OKURA Masafumi (call me “Masa”) • Work:

    Freelance web developer (job opportunities welcome!) • Activities: Kaigi on Rails (the founder, chief organizer), Ruby community host, OSS (Alba and other libraries), public speaking (Friendly.rb next week!) • Favorite method: `BasicObject#instance_eval`
  3. He said… It’s a good idea to read Rails 1.0

    code to learn Rails, because it’s simple
  4. She said… OK, I’d like to read Rails 1.0! …

    But how with only 3-month experience of working as a dev?
  5. Me doing some mentoring at that time … Sorry maybe

    not, this code is really complex. But it’s kind of fun anyway.
  6. Rails has been a web framework that… • Follows MVC

    pattern • M (ActiveRecord), VC (ActionPack) • extends Ruby itself with ActiveSupport • Supports email!
  7. Note about using old (really old) Ruby • Technically, it

    should be possible • https://hub.docker.com/layers/m4i0/ruby/1.8.7-slim/images/ sha256-08b6b71a5f485a10262e0424389078646f700a68e4843b ca5e470985d95e1da0 • https://evilmartians.com/opensource/fullstaq-ruby-docker • It’s just that I didn’t want to get into trouble
  8. CoC

  9. The vibe of ActiveSupport v 1.0 • They feel familiar

    to me (from modern Rails perspective) • blank?, in fl ector and core_ext (open class!) • Some surprises • present? is NOT present here!
  10. The vibe of sca ff olding at v1.0 • I

    must have been the “future” 20 years ago! • Functional tests are generated here in v1.0 • Although now we “Drop system tests” :)
  11. Serious explanation • In Rails 1.0, `where` method doesn’t exist

    • ` fi nd` method was used to do everything, including ` fi rst`, `all`, `order` and `include` • For complex query, ` fi nd_by_` magic method was used • They are all de fi ned in “base.rb”
  12. The vibe of ActiveRecord v1.0 • Base API was quite

    different • Personally `where` seems so natural • ` fi nd_by_name_and_email` magic might be too magical • Association feels so similar • Validation is not “sexy” but it’s so readable • Friendly DSL, metaprogramming inside it
  13. Things remaining from Rails 1.0 to Rails 8.0 • ActiveSupport

    core extensions • `blank?` is a most phenomenal example • In fl ector to encourage CoC • Generators including scaffolding • ActiveRecord association and validation
  14. Why does Ruby make Rails Rails itself? • Those remaining

    parts were (and still are) possible with Ruby’s fl exibility and facility of metaprogramming • Open Class, method_missing, instance_variable_set, etc. • Ruby supports DSL-heavy interface of Rails • Hiding complexity behind DSL
  15. Developer happiness at its core • From version 1.0, Rails

    has prioritized developer happiness • core_ext, CoC, scaffolding, migration, etc. • Although awesome new ideas have been implemented in 20 years, some of them have been available from v1.0, which is impressive • “Shoot yourself a head” power by DHH • Simplicity and conceptual compression
  16. Contact me! • Personal website: https://okuramasafumi.com • ruby.social: https://ruby.social/@okuramasafumi •

    X: https://x.com/okuramasafumi • GitHub: https://github.com/okuramasafumi • LinkedIn: https://www.linkedin.com/in/masafumi-okura-82651128/