20 lines
		
	
	
	
		
			621 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			621 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
Rails.application.config.to_prepare do
 | 
						|
  Model # Zeitwerk autoload model
 | 
						|
 | 
						|
  # Reopen the Model class to add new functionality
 | 
						|
  # This must match the name of your ActiveRecord class exactly.
 | 
						|
  class Model
 | 
						|
    # The 'after_save' macro is now run within the context of the existing Model class.
 | 
						|
    after_save :execute_initializer_after_save
 | 
						|
 | 
						|
    # Define the new method to be executed on save.
 | 
						|
    def execute_initializer_after_save
 | 
						|
      # Your custom logic to execute after Model.save or Model.update! goes here.
 | 
						|
      
 | 
						|
      # 📝 Example Logic:
 | 
						|
      puts "\n-------- JA --------- #{self.id}\n\n"
 | 
						|
 | 
						|
    end
 | 
						|
  end
 | 
						|
 | 
						|
end
 |