Cover Image for Yes, you can read Active Record's code
Cover Image for Yes, you can read Active Record's code
Avatar for kaspth
Presented by
kaspth
Rails Deep-Dive & Riffing
5 Going

Yes, you can read Active Record's code

Zoom
Get Tickets
Ticket Price
$199.00
Per ticket
Tickets
1
About Event

What's in Active Record, is it just tons of magic?

tl;dr: I'm a former Rails core member showing you in this live session how the parts of Active Record you use a bunch actually works, so you can feel more confident when you're using it.

60+ people have already attended these sessions

This Active Record deep-dive session is for Rails developers who are curious and want to know what's going on under the hood. It's for Rails developers who want to go to the next-level in their career — and recognize going beyond their comfort zone is part of it.

We'll stretch the amount of source code you've seen. We'll look at a bunch of the features you're using and give you a high-level overview of what's going on.

You'll walk away with the confidence to open up Active Record and deep-dive on your own, and you'll have more hooks to hang knowledge onto.

Whether you've tried diving into gem's source, are curious or want to see something you can't get anywhere else, come join us!

Your time for reading the actual source code starts now

I'll show you a lot of Active Record code, you can ask questions live so we can lock in your understanding. And you'll have the recording to fine comb afterwards, as much as you like!


The session was incredibly insightful and packed with practical tips and tricks. Even though I’ve been working with Rails since the early days, I still came away with new insights and ideas I can apply directly in my day-to-day development. Highly recommended for any Rails developer looking to level up!

- Hussein Morsy, past attendee


What do we cover when we're live?

In broad strokes, we'll dive into:

  • How belongs_to and has_many are built

  • What's behind scope

  • What happens when you call where and when queries are fired

  • How ActiveRecord and ActiveRecord::Base is structured

  • General tips for going from your Rails app into the Active Record source via and p method(:where) and bundle open activerecord

  • What you'd like to see? You can find ways to reach me on kaspth.com

You're not required to be on video or talk, but you're welcome to put questions and thoughts in the chat throughout the call.

Wait, who's this?

It's Kasper! I was on the Rails core team for six years and I've reviewed thousands of contributor pull requests to Rails. I was the 11th contributor when I left core. You can see my ~1700 commits here. You can read more about me on my website.

I've shipped many features like credentials, form_with, collection caching via render partial: "user", collection: users, cached: true, an internal command infrastructure, maintained and grew GlobalID, invented and extracted Kredis and more. I was also a part of shepherding and reviewing tons of other features (sorry, they blur together after the first 1000 😅).

I've also taken Rails further in my own gems like active_record-associated_object, active_job-performs, oaken and action_controller-stashed_redirects as well as in nice_partials & showcase-rails from my work on Bullet Train.

I grew my Ruby & Rails skills primarily from source diving into gems like Rails itself. I find it's a vastly underrated technique for leveling yourself up, so I'm passing how to do it onto you.


Working with Kasper was everything I hoped for, and more! His deep knowledge of Rails and keen eye for domain modeling allowed him to quickly get up to speed with our project, leaving more time for problem-solving. He helped us overcome two major technical challenges we had been putting off for some time. I’m grateful we had the opportunity to work with Kasper and look forward to collaborating with him again.

I’ve had the privilege of learning from Kasper over the past few months. Thanks to the tools and techniques he shared, I’ve become much faster at debugging and fixing issues by identifying root causes more efficiently. Additionally, I’m now able to help my teammates get unblocked by applying the problem-solving strategies I gained from my time with him. Kasper’s guidance has had a lasting impact on my ability to contribute effectively to my team.

  • Francois Buys, Lead Software Engineer at OmbuLabs

Had an amazing 1:1 session with @kaspth.bsky.social yesterday where he helped me riff on a new feature I am about to start building for mycpaconnect.com.

Feeling way more confident now.

The Rails community is fortunate to have experts like him available to help the rest of us as we build.

  • Zack Gilbert, on Bluesky after having a 1-1 session.


Investigating Rails has many benefits

Rails isn't magic 🪄 reading Rails helps dispel the myth that Rails is magic: it's a lot of Ruby, yes, but it is ultimately understandable and honestly not too bad.

Get a better understanding of how to write APIs: reading the source can give you suggestions of how to or how not to structure your Ruby.

Grow your Ruby skills: for many people the Rails internals are vastly outside their comfort zone, which means you can learn from tons of actual Ruby.

Level up faster: you can feel confident that you can pop open pretty much any gem and start learning how it's made. You read way more code than you write, so getting faster at orienting yourself in new code is a force multiplier.

No other dependency is now scary: Rails is your app's biggest dependency, and getting over the fear of diving into it suddenly opens the door to reading pretty much any other gem with confidence.

You can now evaluate other dependencies: are you thinking of adding a new gem? Well, you've read parts of Rails! Now it's not hard to bundle open gem and skim it. This lets you become a prosumer of open source.

All these skills are applicable to your day job: the better you get at reading code you haven't seen before, the less scary your daily codebase gets — yes, even those parts.

What do I tell my boss?

If you're a boss reading this, investing in your team via training improves your company’s output, but also makes your team feel rightly valued & supported. Spending on training is also tax-deductible.

Here's a Slack template you can send over:

Hey {boss}, I've come across a live guided tour of the Active Record internals. Active Record is how we interact with and structure our database interactions in our app. Investing in this session means we can take better strategic advantage of Active Record & Rails in our app.

This is primarily a tour that focuses on reading code faster & better. As programmers we read a lot of code to build understanding and to prevent mistakes. So training that focuses on reading is a force multiplier for our team.

This tour walks us through really complex parts of Rails and demystifies them for us — doing this on our own would take at least 3x the time.

The tour is run by Kasper Timm Hansen who helped steer Rails while being on the Rails core team. He also shipped many features and reviewed & merged thousands of pull requests to Rails.

Anything else?

Head to kaspth.com for more about me, my links, blog and newsletter. Thanks for checking this out!

Avatar for kaspth
Presented by
kaspth
Rails Deep-Dive & Riffing
5 Going