Alexandre Ruban

May 30, 2023

Rebuilding the Pundit Ruby gem in 33 lines of code

Hello there,

I wanted to share some exciting news with you. I'm starting a YouTube channel dedicated to Ruby and Rails!

pundit-miniature.png


In our first video, we will learn to create internal gems within Ruby on Rails applications, by rebuilding the Pundit gem in just 33 lines of code. This video aims to showcase two key points:

  1. Popular gems like Pundit are not as challenging to implement as they may seem.
  2. We have the power to create our own internal gems within the app/lib directory. Placing them in app/lib ensures they are auto-loaded by Zeitwerk and is a convention to indicate they should not depend on the rest of the application and your business logic.

If you're interested, you can watch the video here: https://www.youtube.com/watch?v=nUnJzaKW-ts

In the next video, we will learn how to extract this Pundit clone in a real Ruby gem to be able to reuse it across multiple Rails applications.

Have a nice day,
Alexandre




About Alexandre Ruban

Ruby on Rails developer.
Creator of the turbo-rails tutorial and the rebuilding turbo-rails tutorial.