View rails4findby2where.sh
#search project for occurances
grep -R find_by_ app/* | awk 'BEGIN {FS=":"}{print $1}' | uniq
#copy original file to .bak and do replacements of find_by with where
for F in $(grep -R find_by_ app/* | awk 'BEGIN {FS=":"}{print $1}' | uniq); do
mv $F $F.bak
sed 's/find_by_id(\(.*\))/where(id: \1).first/g' $F.bak > $F
done