diff options
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/models/company.rb | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 0a35012e67..eec78f95c5 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -656,7 +656,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase def test_inverse_on_before_validate firm = companies(:first_firm) assert_queries(1) do - firm.clients_of_firm << Client.new("name" => "Natural Company") + client = Client.new("name" => "Natural Company") + client.touch_firm_on_validate = true + firm.clients_of_firm << client end end diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index b6b2823978..c9168981fc 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -126,8 +126,9 @@ class Client < Company has_many :accounts, :through => :firm belongs_to :account + attr_accessor :touch_firm_on_validate validate do - firm + firm if touch_firm_on_validate end class RaisedOnSave < RuntimeError; end |