Skip to content

Instantly share code, notes, and snippets.

@lulalala
Created February 21, 2017 06:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lulalala/eca0278bef4ac199368913b4fbe61dac to your computer and use it in GitHub Desktop.
Have ActiveRecord#to_s print out the id. More useful than printing out the Ruby object id.
class ActiveRecord::Base
def to_s
"#<#{self.class.name}:#{self.id}>"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment