Why are you doing
b = A.find(“b-id”) and not b = B.find(“b-id”) ?
I think it would be better if you did
b = B.find(“b-id”)
c = b.becomes(C)
try it in the console and verify that c.class is C
then you should be able to do
c.update_attributes(:attribute_x => ‘present’, :attribute_y => ‘present’)
Your validations will fail if you expect Rails to make the update to an object of class B without attribute_z, which is what you’re doing here:
b.update_attributes({ ‘type’ => ‘C’, :attribute_x => ‘present’, :attribute_y => ‘present’, :attribute_z => nil })
You need b to be of class C if you want your validations to pass.