Your problem is that you call status inside the status method, which causes a problem with infinite recursion.
Most of the answers here focus on using the ActiveSupport :: StringInquirer initializer, for example:
def status return unless self['status'] ActiveSupport::StringInquirer.new(self['status']) end
But you do not need it. ActiveSupport adds a query method for all rows, so you can do it this way:
def status self['status'].try(:inquiry) end
This is the same as using read_attribute :
def status read_attribute(:status).try(:inquiry) end
Or you can just call super:
def status super.try(:inquiry) end
source share