aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/contract.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/models/contract.rb')
-rw-r--r--activerecord/test/models/contract.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/test/models/contract.rb b/activerecord/test/models/contract.rb
index 32bd581377..3f663375c4 100644
--- a/activerecord/test/models/contract.rb
+++ b/activerecord/test/models/contract.rb
@@ -1,6 +1,8 @@
+# frozen_string_literal: true
+
class Contract < ActiveRecord::Base
belongs_to :company
- belongs_to :developer
+ belongs_to :developer, primary_key: :id
belongs_to :firm, foreign_key: "company_id"
before_save :hi
@@ -18,3 +20,7 @@ class Contract < ActiveRecord::Base
@bye_count += 1
end
end
+
+class NewContract < Contract
+ validates :company_id, presence: true
+end