Skip to content

Instantly share code, notes, and snippets.

@mavenlink
Created March 18, 2011 22:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mavenlink/876987 to your computer and use it in GitHub Desktop.
Save mavenlink/876987 to your computer and use it in GitHub Desktop.
Find and count uses of find_by_xxx
#!/bin/sh
grep -R .find_by . | ruby -e 'STDIN.each do |l| puts "#{$1} #{$2}" if l =~ /([_\w]+)\.find_by_([_\w]+)/ && !%w[class self].include?($1) && !%w[solr sql id param].include?($2); end' | sort | uniq -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment