-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Open
Description
Environment
- Ruby 2.5.8
- Rails 6.0.3.1
- Devise 4.7.1
Current behavior
class AuthenticatableUser < ActiveRecord::Base
devise :database_authenticatable
end
pp AuthenticatableUser.first
=begin
#<AuthenticatableUser id: 1, name: "Greg Grimaldus", email: "greg@example.com", nested_field:
=endAdditionally, the output is all one color in a REPL like Pry.
Expected behavior
class NonAuthenticatableUser < ActiveRecord::Base
end
pp NonAuthenticatableUser.first
=begin
#<NonAuthenticatableUser
id: 1,
name: "Greg Grimaldus",
email: "greg@example.com",
nested_field:
#<NestedField:0x0ab88383223
@nested_field_attr=1>,
...MANY_MORE_FIELDS...>
=end Additionally, in a REPL like Pry, each attribute has color highlighting based on the value type.
Cause
The reason this occurs is because Devise::Models::Authenticatable overrides inspect and if the method is overriden, then ActiveRecord::Core#pretty_print defers to super. This is probably PP::ObjectMixin#pretty_print, which doesn't have the niceties described in the "Expected behavior" section.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels