Print caller for query
ActiveSupport::Notifications.subscribe("sql.active_record") do |_, _, _, _, details| if details[:sql] =~ /INSERT INTO "spree_inventory_units"/ puts caller.join("\n") puts "*" * 50 end end