Domanda

Quando l'app Rails va a arresto qual è la procedura che viene seguita? Come posso agganciarmi ai file di pulizia creati durante la corsa dell'app Rails?

È stato utile?

Soluzione

Puoi aggiungere il seguente blocco a config/boot.rb Per eseguire i comandi quando l'app viene chiusa:

at_exit do
  puts "Shutting the app down..."
end

Questo è l'output che vedrai nel processo del tuo server:

[Swanny ~/Sites/test_app]$ bundle exec thin start
>> Using rack adapter
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
^C>> Stopping ...
Shutting the app down...
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top