I need to list all belongs_to associations in a model object and iterate through them. Is there a way to do this?
Thing.reflections.collect{|a, b| b.class_name if b.macro==:belongs_to}.compact #=> ["Foo", "Bar"]
of course, you can pass :has_many, or any other associations too