How to use railway-oriented business transactions to unclutter your Rails controllers - Remi Mercier
01-Dec-2019 1523
When your Rails app needs to handle multiple steps, your controllers’ methods can become a mess.Don’t despair, though. You can delegate sequential steps to business transactions and Marie-Kondo those messy controllers. I’ll show you how.Let’s keep in mind that business transactions are different from ActiveRecord transactions. Business transactions allow you to create a series of steps, each resulting in a Success or a Failure object. ActiveRecord transactions are about ensuring that several database operations work as a single unit and are all rollbacked if any error occurs.In this tutorial, I’ll use the dry-transaction gem whose documentation is neat.
How to use railway-oriented business transactions to unclutter your Rails controllers - Remi Mercier #ruby #rubydeveloper #rubyonrails #railway-oriented #business #transactions #unclutter #Rails #controllers #Mercier https://rubyonrails.ba/link/how-to-use-railway-oriented-business-transactions-to-unclutter-your-rails-controllers-remi-mercier