1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #32572 from nao0515ki/add_optional_true_to_self_joins_section

[ci skip] belongs_to in self join association needs optional: true, if it's over 5.0 ver of rails
This commit is contained in:
Rafael França 2018-04-20 16:30:06 -04:00 committed by GitHub
commit 1e56b31dd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -505,7 +505,7 @@ class Employee < ApplicationRecord
has_many :subordinates, class_name: "Employee",
foreign_key: "manager_id"
belongs_to :manager, class_name: "Employee"
belongs_to :manager, class_name: "Employee", optional: true
end
```