Batman.TransactionAssociationSet is a
Batman.Set used for transactions of has-many associations. It isolates the original
Batman.AssociationSet from any changes to the items or any added or removed items until
applyChanges is called.
Batman.TransactionAssociationSet adds any items that are added to its base set during the transaction. This is so that, if the association is being loaded, the newly-loaded items will appear in the transaction.
save, you can access items that were removed from the association set during the transaction at
removedItems, for example:
parent = parentTransaction.save() # applies changes removedChildren = parent.get('children.removedItems') # Returns `children` that were removed during the transaction
Creates a new
associationSet. It loads the members of
associationSetand observes it for
"itemsWereAdded", adding any items to itself that are added to the base set.
Builds a new instance of the associated model, with
attributesmixed in, then adds it to the
TransactionAssociationSet. Items are expected to not be transactions: they will be made into transactions by
The transaction is added to the set and the original item is also tracked by the set (for the purpose of applying changes). If an item was previously removed, it is no longer considered to be removed.
itemsWereAddedwith the added transactions and returns an array of added transactions.
transactionsfrom the set. These items are still tracked by the set: after
applyChanges, they'll be available as
removedItemson the base association set.
If an item is removed, then added back, it is not put in the
Applies changes to the base
applyChangeson each item in the set
- replacing the
AssociationSet's contents with the updated contents
- putting any removed items in the
Batman.AssociationSetfor this transaction.
Batman.Associationobject from the base
foreignKeyValuefrom the base