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

Assertion wrongfully fails when finding a model #119

Open
royk opened this issue Mar 4, 2015 · 3 comments
Open

Assertion wrongfully fails when finding a model #119

royk opened this issue Mar 4, 2015 · 3 comments

Comments

@royk
Copy link

royk commented Mar 4, 2015

(disclaimer: I am absolutely new with sl-ember-store so maybe I'm missing something fundamental, but I don't see how this is supposed to be working)

In a very simple project containing a single model and a server returning a valid json response for that model, I keep getting the following assertion failure:

A serializer needs to be set for....

Upon examination it seems that the default serializer is chosen. In the assertion execution, the serializer is called with zero arguments, therefore returns undefined, and the assertion fails, as it expects a "true" from the method it is calling.

Removing the assertion results in a program working as expected.

@notmessenger
Copy link
Collaborator

@mattmarcum Do you have any architectural direction you'd like to weigh in with regarding this? I have not yet begun researching this yet but will be.

@mattmarcum
Copy link
Contributor

@royk can we get some code samples? I can't even find that assertion in the code base, at least not in the current version...

@royk
Copy link
Author

royk commented Mar 5, 2015

Thanks for the response.

I am currently using Ember 1.10.0 without Ember Data and used Ember CLI to install sl-ember-store.

The assertion is at sl-ember-store/addon/model.js:146

My own code could not be simpler; the controller triggering the find:

import Ember from 'ember';

export default Ember.Controller.extend({
    init: function() {
        this._super();
        var model = this.store.find("user", 1).then(function(record) {
            return record;
        });
    }
});

The model:

import SlEmberModel from 'sl-ember-store/model';

var User = SlEmberModel.extend({

});

User.reopenClass({
    url    : '/user'
});

export default User;

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

No branches or pull requests

3 participants