Created
March 24, 2012 22:42
-
-
Save carpeliam/2188730 to your computer and use it in GitHub Desktop.
pretty print active record model (good for .irbrc)
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 characters
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