How to debug rails from console with prepend 💎
— Code, Ruby, Rails — 1 min read
How to debug from rails from the console
Imagine you have this
class Dog def speak "woof" endend
module LoudDog def speak "WOOF!!!" endend
Dog.prepend(LoudDog)
Dog.new.speak# => "WOOF!!!"
Boom — speak is overridden!
Similarly you can do this
module MyDebugPatch def find_virtual_account puts "🔍 Overridden find_virtual_account called" super endend
Collection::OrderServices::CreateOrder.prepend(MyDebugPatch)