Tutorials


Throttling Rails logins with Rack Attack | Greg Molnar
This week, I will show you how to rate-limit your authentication endpoints with Rack::Attack.Rack::Attack is a middleware for blocking or throttling requests based on rules. It uses the configured cache store of Rails to store the necessary data, ...


Let's Implement the Map Method from First Principles
After writing the above post, I got a few emails asking me to explain how anonymous functions are different from regular functions and when to use them.In short, you know they are an important concept, and all the examples make sense, but you've n...



TIL: Turbo Stream and personalised content — Good Enough
Hotwire and Turbo are great for very quickly and easily adding real-time updating of webpages without requiring the browser to reload the whole page.But if the information you want to stream back from your server to the client has anything specifi...

Rails 7.1 enhances PostgreSQL enum functionality | Shakacode
In Ruby on Rails, PostgreSQL provides an extension for defining enumerations, which allows you to specify a set of possible values for a column. This is useful when limiting your model's allowed values for a particular attribute.Apart from creatin...

Split your database seeds.rb by Rails environment
The seeds.rb file in a Ruby on Rails app can be a double-edged sword.On one hand, it's very useful! The seeds.rb file makes it easy to pre-populate your database with data for development or production. Unfortunately though, since each Ruby on Rai...

Improve Password Length Validation for BCrypt Compatibility by guilleiguaran
This Pull Request has been created because we identified a need to improve password length validation for BCrypt compatibility in the ActiveModel::SecurePassword module. The current validation only considers the character count, which may not accu...