Skip to content

Instantly share code, notes, and snippets.

@ipoval
Last active November 11, 2015 19:07
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 ipoval/36de5aef564bb67b7243 to your computer and use it in GitHub Desktop.
Save ipoval/36de5aef564bb67b7243 to your computer and use it in GitHub Desktop.
rails find unused model
#
find app/models/ -name "*.rb" | xargs grep -h --color -e ^class | cut -d ' ' -f 2 | sort | uniq | while read k; do echo model class: "$k"; grep -r -l -w -m 1 --color "$k" ./app ./config ./lib ./script --exclude-dir=*assets* | head -n 2 | wc -l | grep 1; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment