In Ruby, you have a choice: define classes or modules either inline or nested within another module. While both approaches achieve similar results, there are key functional differences to consider, making nesting the preferred approach. The Subtle Distinction in Referencing Let’s look at an example using User and Admin::User classes: module Admin class Nested #…
Tag: ruby
SPA without touching Javascript – The magic of Ruby on rails and Hotwire
It’s been a while since I wrote the last post here, so I decided to write something fun and maybe a good sample for anyone that is learning rails or is a little outdated. The idea here is to write a simple CRUD from scratch, I’ll use a Grid layout to keep everything in the…
I see Dead Jobs everywhere (sidekiq DeadSet)
When you are using Sidekiq to handle asynchronous jobs, some times there are exceptions and jobs failing, and I say sometimes because your environment is probably perfect, there is no lag, all services your jobs depend on are always on and responsive, and you probably write better code than most other developers 😛 otherwise it…
Ruby 3.2.0 released with WASI, YJIT, RegExp improvements, …
Last 25 of December while we were all celebrating with our families the Ruby core team released our Christmas gift. The release 3.2.0 of Ruby is faster and brought some amazing tools for us. WebAssembly support Ruby 3.2.0 added initial support for WebAssembly through WASI, this allows running CRuby in a web browser, for example…
Rubyconf Thailand quick summary and slides
Early this December happened the second edition of one of the best ruby conferences I’ve participated up to now! The Bangkok.rb team did an amazing job of organizing 4 amazing keynote speakers and a total of 19 speakers and attendees from over 20 diferent countries. The organization team did an amazing job of receiving the…
Rails from “zero” to kubernetes – horizontal autoscaling
Following up on our previous post, we’ll now make kubernetes work for us, and automatically scale our application.
One of the really cool kubernetes features is the ability to automatically span new pods for your deployment based on the CPU usage of your pods. This is kinda simple, but very useful.
Rails from “zero” to kubernetes – a service to access your pod
In the previous post, we created our first kubernetes pod, but one important part is missing, it is not possible to access that application, we’ll solve this with a service now….
Rails from “zero” to kubernetes – first pod
Last year I wrote about using docker-compose to have a test/development environment similar to your production environment (you can check the post here) My environment kept growing and becoming more complex, and I started using docker swarm to deploy the applications, and after some time I started using kubernetes, I’ve learnt something about kubernetes in…
ActiveRecord Migration UI gem
Really cool gem that allows you to run your pending migrations from the comfort of your browser.
Beware of Date.yesterday on your code (A timezone history)
This post is the write-up of how I fixed a production problem that happened a few minutes ago, and can probably save some time for you too, so read this and remember for your next code that deals with time