Created
December 7, 2012 18:09
-
-
Save pmontrasio/4235159 to your computer and use it in GitHub Desktop.
Gets the last POST parameters in Rails's log/development.log and pretty prints them
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# DO NOT USE ON PRODUCTION LOGS: maybe there are ways to inject Ruby code into the | |
# parameters hash and you'll end up evaluating it | |
# | |
# usage: post_params | |
# run this in the main Rails directory | |
# tested on Linux with ruby 1.9.3-p327, bash 4.2.24 | |
last_post_line=`grep -n "Started POST " log/development.log |tail -1|cut -f1 -d":"` | |
hash_line=`expr $last_post_line + 2` | |
hash=`sed -n -e "${hash_line}p" log/development.log |sed -e 's/Parameters:/hash =/'` | |
echo "require 'pp';$hash;pp hash" | ruby -E UTF-8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It wasn't working for me with Rails 3.2.x