I need to list all belongs_to associations in a model object and iterate through them. Is there a way to do this?
You can make use of reflect_on_all_associations method from Reflection For example:
Thing.reflect_on_all_associations(:belongs_to)
2.1m questions
2.1m answers
60 comments
57.0k users