Skip to content

Conversation

@kindrowboat
Copy link
Contributor

This fixes an issue where if a Her model, with a has_many association was built with an empty array for said association, that an error would be raised when #to_params was called on that object.

The root of this problem was a next clause in the middle of an #inject (which causes the memo, formerly a hash, to become nil).

Regardless, it didn't seem to me that the next clause was accomplishing anything. An association skipped here because it was blank would still be included in the #to_params result because it was being merged with the existing params. Removing the offending clause did not break any current specs.

Also a ninja bug fix to use #her_nearby_class to determine the class to call #include_root_in_json.

@dturnerTS
Copy link
Contributor

I actually have this fixed in an outstanding PR #262 sorry you ran into the bug.

@kindrowboat
Copy link
Contributor Author

Aha, so it does! I also didn't know has_one serialization had been implemented by someone. Good stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants