Giter VIP home page Giter VIP logo

Comments (9)

ericeslinger avatar ericeslinger commented on September 2, 2024

Quick follow-up on this. After tracing with the debugger, it seems clear that there's a call to reifyClientId on Social.User which processes through properly (with model being in scope on 2750), but there's a second call to reifyClientId where things don't work, and the model variable is null on line 2750. I'm probably doing something incorrect in my routing, which died quietly under ember-model but not so under epf.

from epf.

dogawaf avatar dogawaf commented on September 2, 2024

#32 is about about reserved words.

from epf.

denisnazarov avatar denisnazarov commented on September 2, 2024

Is your server returning the proper JSON with the id field populated?

from epf.

ericeslinger avatar ericeslinger commented on September 2, 2024

Yeah, as far as I can tell there's some sort of error involved in pulling single values out of the REST adapter (and it could easily be an error on my part, because this seems like reasonably-common behavior). I'm easily able to pull everything in /api/nouns and do an {{#each noun}}{{name}}{{/each}} construct, but if I do a /api/nouns/1 by calling @session.find 'noun', 1 instead of @session.query 'noun', I end up with the error in creating client_id strings.

Rather than pursue this bug at this time, I've reverted back to ember-data for now.

from epf.

denisnazarov avatar denisnazarov commented on September 2, 2024

From the docs, loading an individual model is done as follows:

App.PostRoute = Ember.Route.extend({

  model: function(params) {
    return App.Post.find(params.post_id);
  }

});

App.PostRoute = Ember.Route.extend({

  model: function(params) {
    return this.session.load('post', params.post_id);
  }

});

from epf.

ericeslinger avatar ericeslinger commented on September 2, 2024

yeah, that's what I'm doing - @session.load 'user' 1 is equivalent to the return this.session.load('post', params.post_id); in your response.

I'm pretty sure my server is returning reasonable JSON - it's formatted using activemodelserializers, and can be digested in list-form by EPF and in singular form by ember-data and ember-model. I also experimented with pushing client_id as a property (by defining it on the serializer and verifying it changed in the API). I can clearly see the query going to rails, but for some reason things fail when establishing a client_id on a new object. Go figure.

from epf.

ericeslinger avatar ericeslinger commented on September 2, 2024

Aha, I figured it out - there was a combination of errors that looked similar, so I was conflating them.

First of all, if the serialized JSON object doesn't have an id field named id, it breaks. This is reasonable, and was the root cause of most of my errors - I couldn't deserialize the object because it was looking for a non-existant id.

The other problem is more serious, and maybe I'll open a new issue to document it, and it has to do with non-numeric routing IDs.

I am routing /api/users/:user_id with server logic so that /api/users/NUMBER shows a record, which is pretty standard, but also routing /api/users/current to the current user (as determined by the session cookie). This throws the same to_string error on client id as before, and I imagine it has something to do with the non-numeric value being passed to the query string.

from epf.

ghempton avatar ghempton commented on September 2, 2024

hmm I am very interested in getting to the bottom of your second issue. I think the issue with /api/users/current is that it thinks current is the ID which in fact is not.

from epf.

ghempton avatar ghempton commented on September 2, 2024

Is this still an issue? Lots has changed, I will reopen if this has not been fixed.

from epf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.