Save 36% for Black Friday! Learn more

Siyanda Maphumulo

Joined

10 Experience
0 Lessons Completed
0 Questions Solved

Activity

Hi, I think I had a simalr issue while dealing with and employee (User) and manger (also User) relationship, my solution was to use a self-jion or self referential association

migration

    add_reference :users, :manager, foreign_key: { to_table: :users }, index: true

model

  belongs_to :manager, class_name: "User"
logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.