diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-06-04 16:08:40 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-06-04 23:28:55 +0900 |
commit | c256d02f010228d260b408e8b7fda0a4bcb33f39 (patch) | |
tree | 45467f45eb82fabb5e58de22a3e5f3349f9c2862 /activerecord/test/cases | |
parent | 69d91cd6a6a734ee1c383eac8c45e3cdc9f781b9 (diff) | |
download | rails-c256d02f010228d260b408e8b7fda0a4bcb33f39.tar.gz rails-c256d02f010228d260b408e8b7fda0a4bcb33f39.tar.bz2 rails-c256d02f010228d260b408e8b7fda0a4bcb33f39.zip |
Initialization block is a part of `build_record`
Should be done before `before_add` callbacks.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 0facc286da..46fa36d7dd 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -737,6 +737,18 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase [:added, :before, "Roger"], [:added, :after, "Roger"] ], log.last(4) + + post.people_with_callbacks.build { |person| person.first_name = "Ted" } + assert_equal [ + [:added, :before, "Ted"], + [:added, :after, "Ted"] + ], log.last(2) + + post.people_with_callbacks.create { |person| person.first_name = "Sam" } + assert_equal [ + [:added, :before, "Sam"], + [:added, :after, "Sam"] + ], log.last(2) end def test_dynamic_find_should_respect_association_include |