diff options
author | Guo Xiang Tan <tgx_world@hotmail.com> | 2018-08-21 23:23:17 +0800 |
---|---|---|
committer | Guo Xiang Tan <tgx_world@hotmail.com> | 2018-09-03 13:34:24 +0800 |
commit | 90240f664c1c9e294f4230431fe2284ded19b58c (patch) | |
tree | 06c3d7f1fd368fff3255f0b5bd5bdfdf3455661d /activerecord/test/models/company.rb | |
parent | f3fe56c7326ed38f218c4c61e3395052e9d75d71 (diff) | |
download | rails-90240f664c1c9e294f4230431fe2284ded19b58c.tar.gz rails-90240f664c1c9e294f4230431fe2284ded19b58c.tar.bz2 rails-90240f664c1c9e294f4230431fe2284ded19b58c.zip |
Fix regression setting children record in parent before_save callback.
Diffstat (limited to 'activerecord/test/models/company.rb')
-rw-r--r-- | activerecord/test/models/company.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index d4d5275b78..485b35d58b 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -204,4 +204,12 @@ end class VerySpecialClient < SpecialClient end +class NewlyContractedCompany < Company + has_many :new_contracts, foreign_key: "company_id" + + before_save do + self.new_contracts << NewContract.new + end +end + require "models/account" |