From 8fccbc1ad4fff215c63d17b9321fc69ad17e89dc Mon Sep 17 00:00:00 2001 From: Adam Gamble Date: Thu, 31 Jan 2013 21:54:41 -0600 Subject: Modifies belong_to touch callback to touch old associations also #9091 --- activerecord/CHANGELOG.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'activerecord/CHANGELOG.md') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index f73fc9d9a3..7dbfad4473 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -447,6 +447,28 @@ *Aaron Stone + Rafael Mendonça França* * `Relation#merge` now only overwrites where values on the LHS of the +======= +* Belongs_to :touch behavior now touches old association when + transitioning to new association + + class Passenger < ActiveRecord::Base + belongs_to :car, touch: true + end + + car_1 = Car.create + car_2 = Car.create + + passenger = Passenger.create :car => car_1 + + passenger.car = car_2 + passenger.save + + Previously only car_2 would be touched. Now both car_1 and car_2 + will be touched. + + *Adam Gamble* + +* Relation#merge now only overwrites where values on the LHS of the merge. Consider: left = Person.where(age: [13, 14, 15]) -- cgit v1.2.3