Created
January 18, 2015 23:42
-
-
Save CoryFoy/6ddfd53af3559151b9b7 to your computer and use it in GitHub Desktop.
Revisions
-
CoryFoy created this gist
Jan 18, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #You can use this from a rails console by creating this #in a directory, starting up rails c, and then doing a #'load fields.rb'. Then just call Fields.show_report class Fields def self.show_report Rails.application.eager_load! ActiveRecord::Base.descendants.each do |model| table_name = model.table_name puts "Varchar length report for #{table_name}" puts "-------------------------------------------------" puts "" begin model.columns.each do |col| puts " #{col.name}: #{col.limit}" if col.type == :string end rescue puts "Table not valid" end puts "" puts "" end puts "-------------------------------------------------" puts "END OF REPORT" end end