remi / her

Her is an ORM (Object Relational Mapper) that maps REST resources to Ruby objects. It is designed to build applications that are powered by a RESTful API instead of a database.
MIT License
2.05k stars 322 forks source link

Fix infinite loop when parsing nested associations #539

Open gordysc opened 4 years ago

gordysc commented 4 years ago

It appears with this commit a potential infinite loop was introduced if models defined both has_many/belongs_to.

To mitigate this, I've added a straightforward check for belongs_to to no-op if the association is already defined on the resulting object. Also, sorry for the previous PR! Moved this under my company's organization for easy access to the rest of my team.

Finally, it appears we're now respecting included_root_element for nested associations. This PR also adds an option to opt out of this new behavior as well as potentially use a different name via included_embedded_root_element

gabrielrdrguez commented 3 years ago

Somebody please give a medal to this man! (and merge this PR :stuck_out_tongue: )