ruby on rails self referencing model code example
Example: self referencing association in ruby on rails
has_many :users, class_name: 'User'
belongs_to :manager, class_name: 'User', optional: true
has_many :users, class_name: 'User'
belongs_to :manager, class_name: 'User', optional: true