Can you make a model belong to another in a method in the controller file?

Ive heard of models belonging to another through setting it in the model file with belong_to but can it work inside a method in a controller file?

This is a strange requirement, because an association like that is not typically something dynamic.

Can you explain the use case in your application?