I have a model that declares multiple has_many relationships. Is there meta data available in ActiveRelation such that I can loop through these has_many relationships when working with this model in order to see how many has_many relationships the model is involved in, and then access the contents of each from there?
Some pseudocode (will not run) if it helps clarify what my goal is:
MyModel.has_many_relationships.each do |relationship|
relationship.contents.each do |content|
# ...
end
end
Sure you can!
Try searching for “reflect_on_all_associations” in the Rails documentation!