Sometimes we want to stop the program: maybe a critical error has ocurred. To immediately stop a request within a filter or route use:
haltYou can also specify the status when halting:
halt 410Or the body:
halt 'this will be the body'Or both:
halt 401, 'go away!'With headers:
halt 402, {'Content-Type' => 'text/plain'}, 'revenge'It is of course possible to combine a template with halt:
halt erb(:error)
See
Casiano Rodriguez León 2015-01-07