ActiveType 1.2 supports "change_association"

With ActiveType Archive 1.2 you can modify associations (has_many etc.) after they have been defined.

One common use case for this is to change an association inside a form model, like this:

class Credential < ActiveRecord::Base

class User < ActiveRecord::Base
  has_many :credentials

class SignUpCredential < ActiveType::Record[Credential]

class SignUp < ActiveType::Record[User]
  change_association :credentials, class_name: 'SignUpCredential'

Now, if you load credentials, you will automatically receive records of type SignUpCredential.

Tobias Kraze about 3 years ago
This website uses short-lived cookies to improve usability.
Accept or learn more