Open rgaufman opened 6 years ago
@rgaufman I will work on this. I did some experiments in the past and it's true that those cases should be handled in a better way.
irb(main):012:0> Transaction[3].remove NoMethodError: undefined method 'timestamp=' for #<Transaction:0x0000561b588b76e8>
I have the same problem when try to delete object with the attribute, deleted from model before
Maybe just having more explicit exceptions that suggest the standard solution to the problem would be enough?
@katecanaveral this happens because you'd have to set to nil the attribute in all objects before you remove attribute :timestamp
from your code, since the Transaction#timestamp
and Transaction#timestamp=
methods are defined by Ohm when attribute
is present.
If I'm not mistaken, the process would be:
1) Set all Transaction#timestamp
to nil - with a migration-like script or manually.
2) Remove attribute :timestamp
.
3) Deploy the new code.
@pote thanks for the solution
When I change my model, any fields that are still present in Redis cause a NoMethodError, e.g.
Is there any way to get Ohm to ignore any fields from Redis that are not in the model? - or is there some other recommended strategy to handle this?