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)
1.4m articles
1.4m replys
5 comments
57.0k users