Skip to content

Instantly share code, notes, and snippets.

@virajkulkarni14
Created October 31, 2013 11:59
Show Gist options
  • Save virajkulkarni14/7248519 to your computer and use it in GitHub Desktop.
Save virajkulkarni14/7248519 to your computer and use it in GitHub Desktop.
Finding total number of rows in a database in Rails
st=0; ActiveRecord::Base.send(:subclasses).each {|sc| st += sc.all.size}; puts "Total number of rows is #{st.to_s}"
@virajkulkarni14
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment