[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:
nao0515ki 2018-04-14 22:28:01 +09:00
parent 662ba236d1
commit 8300268441
1 changed files with 1 additions and 1 deletions

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
```