views:

26

answers:

3

Is it possible to grab a post variable in a action, output it to the screen, and then halt execution?

in asp.net I would do:

Response.Write (Request.Form["blah"]);
Response.End();
+1  A: 
puts params[:blah]
abort
ennuikiller
A: 

If you are trying to send it back to the browser (output to screen?) to debug, you can drop this line in your action. The "return" will prevent a double render error. But this will not halt execution of after_filter if you have one.

  render :text=> params[:blah] and return
cowboycoded
If you are just doing this to debug something, I would recommend just tailing your application server logs. All of the params will show up in the logs.
cowboycoded
+2  A: 

In addition to suggestions already mentioned, you can raise exceptions:

raise params[:blah]
raise params.inspect
raise params.to_yaml
# ...and so on

In this case, you can even just do raise without specifying anything. Rails will by default print out all params as part of its exception message screen.

vonconrad