aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/company.rb
diff options
context:
space:
mode:
authorAndrey Subbota <subbota@gmail.com>2018-07-17 12:55:30 +0300
committerAndrey Subbota <subbota@gmail.com>2018-07-27 00:38:21 +0300
commit35ee756a366d3ac80128a017cf8ba197a0fdd4a1 (patch)
tree85d116200b8d468622d5ce540e0aee0088eb64c5 /activerecord/test/models/company.rb
parentf0c917c7d491f4f7b142748375e1128d5579152a (diff)
downloadrails-35ee756a366d3ac80128a017cf8ba197a0fdd4a1.tar.gz
rails-35ee756a366d3ac80128a017cf8ba197a0fdd4a1.tar.bz2
rails-35ee756a366d3ac80128a017cf8ba197a0fdd4a1.zip
Allow subclasses to redefine autosave callbacks for associated records
Diffstat (limited to 'activerecord/test/models/company.rb')
-rw-r--r--activerecord/test/models/company.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb
index d4d5275b78..65c702b006 100644
--- a/activerecord/test/models/company.rb
+++ b/activerecord/test/models/company.rb
@@ -122,6 +122,12 @@ class RestrictedWithErrorFirm < Company
has_many :companies, -> { order("id") }, foreign_key: "client_of", dependent: :restrict_with_error
end
+class Agency < Firm
+ has_many :projects, foreign_key: :firm_id
+
+ accepts_nested_attributes_for :projects
+end
+
class Client < Company
belongs_to :firm, foreign_key: "client_of"
belongs_to :firm_with_basic_id, class_name: "Firm", foreign_key: "firm_id"