In my model I have
field :is_open, type: Time, default: nil
However previously in this same model, I stored this type as a boolean. I now want to change it to type Time. For new items in my database this works fine, however for old records where it's still stored as a boolean, when I try to access this attribute
modelInstance.is_open
I get the following error:
#<NoMethodError: undefined method `getlocal' for true:TrueClass>
Instead of changing all the booleans in my mongo database to Time objects, is there a way/hook I can do on mongo so that when this attribute is pulled from the document, I can check if it's a boolean and replace it with a timestamp?