Tutorials


Rails 6.1 deprecates rails db:structure:dump and rails db:structure:load
Rails 6.1 deprecates rails db:structure:load and rails db:structure:dump tasks.Before Rails 6.1, executing rake db:schema:dump would dump db/schema.rb file. And executing rake db:structure:dump would dump db/structure.sql file.Rails provides confi...


Building a Ractor based logger that will work with non-Ractor compatible code
But we want to share a logger, right? Well, not exactly. What we want is to be able to use the same API to log pieces of information. And that’s the key point here.We can bypass all of our problems quickly. We just need a separate Ractor that will...

Solve race condition using database trigger function
As example, we have a Budget model, which have allocation_cents as the amount allocated for the budget, which can be used to buy the items proposed in the budget.A budget can have many_items, and we need make sure that the sum of the items' price ...

One-liner introduction - Ruby one-liners cookbook
I assume you are already familiar with use cases where command line is more productive compared to GUI. See also this series of articles titled Unix as IDE.A shell utility like bash provides built-in commands and scripting features to make it easi...

Automate Rails server provisioning and deployment using Ansible and Capistrano
One of the hardest thing while learning Rails is to put your Rails application online on the internet so the public can access it. Many tutorials usually recommends Heroku as it is really simple to use, but the downside is that it can get expensiv...

Modern Rails flash messages (part 2): The undo action for deleted items
For my needs (and for this article) I chose to use the soft-delete method.This solution using a mechanism to mark a record as deleted instead of deleting it. The application is then set up to display only records without the mark (like active only...

Gustavo Caso: Writing a Ractor Base Job Scheduler
A background job processor allows you to offload heavy computational tasks from the main process to other processes.Imagine a typical request/response inside a Rails app, you would like to provide your users with the fastest response, but some req...