user.rb
after_initialize :init
private
def init
self.name ||= 'Bob'
end
irb
irb> User.select('id')
(Object doesn't support #inspect)
If I change the callback to before_validation then the above query works.
Ideally I would like to be able to keep the initialization in after_initialize. Is there a way to achieve this?
I would prefer not to have to override the initialize method.
User.first? I don't know ifselectactually (or fully) instantiates anAR::Baseobject...after_initializeis a solution?