Read more

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

Deleted user #6
June 08, 2015Software engineer

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


Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

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.

Posted to makandra dev (2015-06-08 11:38)