dimanche 28 février 2016

Ruby on Rails: how can I show a variable and then exit?

I am still working on my small app interacting with the Steam API. I am fiddling with Nokogiri and regexps among other things and I want to output a certain variable before stopping the script. This is in a viewless action where, at the end of the process the user will be redirected to another action with a view.

I tried puts then exit but Apache hangs and I have to restart it manually. Since most of the time I want to display the variable from inside a loop, I don't want to let the rest of the script continue. Is there a way I can just show the variable's contents and the terminate the script execution from the controller? If it's not possible I could deal with logging the variable's contents before terminating the script instead of outputting it.

Aucun commentaire:

Enregistrer un commentaire