Created
May 17, 2018 06:11
-
-
Save kokigit/f6ef515074fb47ff5fc2f94df36a04bf to your computer and use it in GitHub Desktop.
to print rails active record objects with indented json out put put this function on ~/.irbrc file. then it will be loaded with irb or rails console
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 pp(obj) | |
puts JSON.pretty_generate({ "#{obj.class.name.underscore}" => obj }.as_json) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment