awesome-print / awesome_print

Pretty print your Ruby objects with style -- in full color and with proper indentation
http://github.com/michaeldv/awesome_print
MIT License
4.08k stars 454 forks source link

No formatting #294

Closed pustovalov closed 6 years ago

pustovalov commented 7 years ago
(byebug) ap current_user
#<User:0x007f80633c8b70> {
                 :id => 1,
              :email => "1@gmail.com",
               :name => "3",
    :password_digest => "$2a$10$rG9JxtoimW1rRgJQxWmcNOqd6galhkcuiQ/ghmC1LgNAqFhW3e9nW",
              :admin => false,
         :created_at => Sat, 07 Jan 2017 01:57:03 UTC +00:00,
         :updated_at => Sun, 08 Jan 2017 22:34:11 UTC +00:00,
             :locale => "en"
}
nil
(byebug) ap current_user.errors
#<ActiveModel::Errors:0x007f8061de7130 @base=#<User id: 1, email: "1@gmail.com", name: "3", password_digest: "$2a$10$rG9JxtoimW1rRgJQxWmcNOqd6galhkcuiQ/ghmC1LgN...", admin: false, created_at: "2017-01-07 01:57:03", updated_at: "2017-01-08 22:34:11", locale: "en">, @messages={:name=>["has already been taken"]}, @details={:name=>[{:error=>:taken, :value=>"3"}]}>
nil
(byebug)

Is this the expected result?

version: 1.7.0

mattwelke commented 7 years ago

Funny you post this. I was getting odd behaviour like that yesterday too. awesome_print is my go to printing gem and yesterday was the first time I noticed that. Some things would print out nicely like your "current_user" and others would print just that regular representation.

gerrywastaken commented 7 years ago

I'm not too sure. But I'll certainly accept a PR which addresses this.

dshinzie-zz commented 7 years ago

@gerrywastaken I looked into this issue, and the reason is that Active Record errors are actually from ActiveModel::Errors instead of ActiveRecord::Base. Checkout the PR I made that resolved the issue