Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serializer.pushPayload is not a function #132

Closed
hoIIer opened this issue Aug 19, 2015 · 9 comments · Fixed by #133
Closed

serializer.pushPayload is not a function #132

hoIIer opened this issue Aug 19, 2015 · 9 comments · Fixed by #133

Comments

@hoIIer
Copy link

hoIIer commented Aug 19, 2015

hello,

I am trying to push a record to the store that I get from a regular ajax callback.. tried using pushPayload but get Uncaught TypeError: serializer.pushPayload is not a function

any ideas why?

      request.done (response)=>
        response['id'] = response.username
        @store.pushPayload 'user', response
@hoIIer
Copy link
Author

hoIIer commented Aug 19, 2015

this seems to work though.. is there anyway to use the serializer from this package to automatically create json-api doc from my api response?

      request.done (response)=>
        # Form json-api object and push into the store.
        data =
          'type': 'user'
          'id': response.username
          'attributes':
            'full_name': response.full_name
            'username': response.username
            'email': response.email
            'uid': response.uid
        @store.push data

@dustinfarris
Copy link
Owner

We are considering extending DS.RESTAdapter and DS.RESTSerializer (see #128). pushPayload would be an added benefit of doing that. Otherwise we'll have to implement this in EDA. Thanks for reporting this.

@hoIIer
Copy link
Author

hoIIer commented Aug 19, 2015

ok cool, what is eda?

@dustinfarris
Copy link
Owner

Ember Django Adapter :-)

@hoIIer
Copy link
Author

hoIIer commented Aug 19, 2015

doh duh! hah ok thanks

@benkonrath
Copy link
Collaborator

@erichonkanen Can you test the PR in #133 to see if it solves this problem? Thanks.

@hoIIer
Copy link
Author

hoIIer commented Aug 28, 2015

@benkonrath yep uno momento

@benkonrath
Copy link
Collaborator

@erichonkanen Please reopen this issue if it's still causing problems for you.

@hoIIer
Copy link
Author

hoIIer commented May 1, 2016

what is the recommended way to push an object into the store that is returned from an $.ajax() request? I seem to be getting issues using latest version:

WARNING: Encountered "data" in payload, but no model was found for model name "datum" (resolved model name using client-web@serializer:user:.modelNameFromPayloadKey("data"))

      request.done (response)=>
        data = @store.normalize 'user', response
        @store.pushPayload 'user', data

response:

{"uid":"92b4b954-aa75-4e5b-a01f-5f20912258ec","avatar":null,"avatar_thumbnail":null,"email":"[email protected]","username":"blue","full_name":"tallerholler"}

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 a pull request may close this issue.

3 participants