RSSAmplifier

Blog

MaxLapDev

Ruby, Rails, Tools

maxlap.devRSS feed ↗4 posts

Latest posts

The lesser known Rails race condition

Note: This post mentions and gives examples in Rails, but the content is relevant to anyone using databases systems, regardless of the use cases. There are many posts around discussing race conditions in Rails and how to handle/avoid them, but I haven't seen one discussion this particular case. Simply put, race conditions happen when more than one worker/process/thread interact with the same data…

Vision and glasses

This is not in my usual style. This is a little visualization tool I wanted to have. It's likely this will be improved upon over time. I just wanted to release it to be able to show it to friends and family. Other than "glasses work by bending light and usually make us see clearer", the way they interact with our vision is not common knowledge. The goal here is to help you understand the effects…

What makes Ruby's blocks great

In Ruby, we often talk about "blocks". While not unique to Ruby, few mainstream languages have something I would consider equivalent and, to be frank, I think they're missing out. Just explaining to someone what's special about them can be tricky. I think many rubyists use blocks without realizing that they are different from what's possible in other mainstream languages. This post is an attempt…

You should avoid `includes` in Rails

includes is the recommended way to load associations of your records eagerly in Rails. In fact, the Ruby on Rails guide for eager loading only mentions includes . However, there are other ways, and I want to argue that you should avoid includes . Here's why: includes makes it easy to introduce an odd bug preload takes the same arguments as includes , but can't introduce the bug When needed,…