Skip to content

Instantly share code, notes, and snippets.

@carpeliam
Created March 24, 2012 22:42
Show Gist options
  • Save carpeliam/2188730 to your computer and use it in GitHub Desktop.
Save carpeliam/2188730 to your computer and use it in GitHub Desktop.
pretty print active record model (good for .irbrc)
def arp(model)
key_length = model.attributes.keys.max_by(&:size).size
model.attributes.sort.each do |k,v|
puts "#{k.ljust key_length}: #{v.inspect}"
end
return nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment