title: create dynamic default values for column in rails?
body: <p>I am not sure how to go about this, or if there is a better way to do this, but I have a table called leads(many) and it references agent (one). </p>
  
  <p>I want to make a migration that sets a default value for the agent_id column in the leads table. But i want the default value to loop through all the agent ids. Im not sure how to do this!? Should i use a call back, or should i do in migration file? </p>
  
  <p>Here is the actual question im trying to tackle:</p>
  
  <p>When new leads are created assign it to an agent using a “round robin” That way new leads are distributed evenly across all the agents.</p>
  
  <p>Ive attached a screenshot using SUDO code (i know its not functional as is) as to what I am thinking of doing. Any tips?</p>
  
  <p>(Using ruby on rails w/ postgresql)</p>
  
  <p><img src="https://i.stack.imgur.com/cNES9.png" alt="enter image description here"></p>