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 web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
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)