Skip to content

Instantly share code, notes, and snippets.

@amiel
Created February 19, 2010 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amiel/309015 to your computer and use it in GitHub Desktop.
Save amiel/309015 to your computer and use it in GitHub Desktop.
# my bash one-liner of the day
for file in app/models/trade_plan/*;do l=`head -1 $file|ruby -p -e 'm=$_.match /TradePlan::(\w+)/;$_=m[1]'`; ruby -p -i -e 'if $_.match /end/;$_=%( belongs_to :option, :class_name => "Listing::'$l'"\nend);end' $file;done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment