Tutorials

Handling Decimal Precision in Rails - DEV Community
Ruby on Rails allows us to specify how precise we want decimals to be by defining precision and scale in database migrations. Rails also provides a way of adding front-end validation to forms that accept decimal values. I’ll be using an expense mo...





What to do when you need a button_to within a form in Rails
Imagine that you have a form to update a record (let’s say a product record) and inside the form, you are showing a list of images, and each image needs a button to remove it. You tried to use button_to but it doesn’t work because in html you can.

Are you absolutely sure your `has_one` association really has one association?
Learn about an unexpected limitation with this API and how to combat it universally.The Rails has_one API has an unexpected limitation: It does not prevent multiple records from being associated to the parent record.Take this simple example straig...

How to improve and standardize writing services in Ruby project - DEV Community
In this short note, I want to share with you a way to create services of any complexity in Ruby... Tagged with ruby, rails.Everything to know about Servactory gem.Repository in GitHub: github.com/afuno/servactoryDocumentation: servactory.comThe li...

Lazy Loading with Stimulus and Tailwind | Ruby on Rails 7 Tutorial - YouTube
Lazy load with a spinning widget and placeholder templates in this Stimulus and Tailwind, Ruby on Rails 7 tutorial!Checkout my course(s) at: https://learn.deanin.comSource:https://github.com/Deanout/lazy_loadingLinks:https://www.stimulus-component...

How to migrate AASM to ENUM while keeping users in mind - DEV Community
In this article, we will address a common challenge when migrating from the AASM state machine to the Rails built-in enum. The main problem we aim to solve is ensuring a seamless transition without causing disruptions or data inconsistencies for u...