Customizing inspectable attributes in AR Rails 4.

16 views
Skip to first unread message

Don Schrimsher

unread,
Apr 8, 2016, 5:09:15 PM4/8/16
to Ruby on Rails: Core
I ran into a case where I wanted to customize the output of the inspect method to include attributes that I've defined (which are not associated with database columns) to be displayed in the inspect output. Currently, the attributes for inspection are collected by calling ActiveRecord::ModelSchema::ClassMethods#column_names. It would be nice to instead use a template method that allowed additional, non-database backed attributes to be included without having to rewrite the inspect method.

Reply all
Reply to author
Forward
0 new messages