Rails 3 ActiveRecord::Persistence#becomes does not copy changed attributes

Note: ActiveRecord::Base#becomes has a lot of quirks and inconsistent behavior. You probably want to use ActiveType.cast instead.


This issue will be encountered when relying on attribute_was methods of ActiveModel::Dirty after casting a model which has defaults to a form model, for example.

In my case a record with an assignable_values Show archive.org snapshot legacy value became invalid when it should not.

The initializer in the attached file will fix this issue.

This patch is planned to be included in the next makandra Rails LTS Show archive.org snapshot release.

Martin Straub