Skip to content

Instantly share code, notes, and snippets.

@psahni
Created May 19, 2015 07:40
Show Gist options
  • Save psahni/fa6cf6ef41102c8ddc95 to your computer and use it in GitHub Desktop.
Save psahni/fa6cf6ef41102c8ddc95 to your computer and use it in GitHub Desktop.
Active record hacks
# GET COLUMN NAMES AND THEIR TYPE
ActiveRecord::Base.connection.columns(table_name).each {|c| puts "- " + c.name + ": " + c.type.to_s + " " + c.limit.to_s}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment