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:
commit
1e56b31dd6
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue