I'm currently using ActiveRecord single table inheritance.
How can I cast one of my models from type A to B? They have the same parent.
I'm currently using ActiveRecord single table inheritance.
How can I cast one of my models from type A to B? They have the same parent.
If we have something like following
class A < ApplicationRecord
end
Class B < A
end
we can use becomes
a = A.first
b = a.becomes(B)
or vice versa