From 0913b8eab92daaadd8e0f089092a8e9070632245 Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Wed, 29 Oct 2025 15:05:18 +0100 Subject: [PATCH] wip: initializer --- .../usr/src/app/config/initializers/xrforge.rb | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/manyfold/usr/src/app/config/initializers/xrforge.rb b/manyfold/usr/src/app/config/initializers/xrforge.rb index bc8b17f..f036aa8 100644 --- a/manyfold/usr/src/app/config/initializers/xrforge.rb +++ b/manyfold/usr/src/app/config/initializers/xrforge.rb @@ -1,18 +1,26 @@ +require 'pp' + Rails.application.config.to_prepare do Model # Zeitwerk autoload model + ModelFile - # Reopen the Model class to add new functionality - # This must match the name of your ActiveRecord class exactly. + # extend by adding listeners class Model # The 'after_save' macro is now run within the context of the existing Model class. - after_save :execute_initializer_after_save + after_commit :run_cli_hooks # Define the new method to be executed on save. - def execute_initializer_after_save + def run_cli_hooks # Your custom logic to execute after Model.save or Model.update! goes here. # 📝 Example Logic: - puts "\n-------- JA --------- #{self.id}\n\n" + puts "\n-------- MODEL --------- #{self.id}\n\n" + pp self + puts "\n\n" + + command = "pwd" + system(command) + end end