To establish a relationship between two related models and assign a value, define the relationship method in one model, then use that method to associate the models and set the desired value.