Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Metadata usage? #82

Closed
gautampunhani opened this Issue · 2 comments

2 participants

@gautampunhani

I was trying to use metadata with my Her model. While the middlware segregates the response into data, errors and metadata, but on model initialization the parameters of metadata being send-in are parsed_data[:data] instead of parsed_data[:metadata].
Saw your comment
#16 (comment)

Was curious to know if it is something that has been done intentionally or is it some feature in-dev?

@remiprev
Owner

Actually, that comment is not accurate anymore.

If your model data has a metadata key, it’s going to be parsed by the detault middleware (here) and passed to the initializer through the :_metadata special key (here). The initializer is going to keep it in the resource’s metadata accessor (here). Same thing goes for the errors key, which is stored in the response_errors accessor.

There was a typo in the find method though, so that currently only works in the master branch.

Hope that helps!

@remiprev
Owner

I’m gonna close this issue now and hope that my last comment helped you solve it!

@remiprev remiprev closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.