-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
Handle active model formatted request data properly #187
Handle active model formatted request data properly #187
Conversation
This was good idea .. |
0aff8ea
to
eb03b6a
Compare
@danielspaniel added tests in updated commit |
with added tests, the build is failing for some reason .. can you check it out? |
yeah it looks like DS.RESTAdapter test is failing because the root key is |
I thought that might happen .. if it's not easy to fix I can help out later today. |
seems like there is no way to differentiate between ActiveModelAdapter and RESTAdapter now? https://github.com/danielspaniel/ember-data-factory-guy/blob/master/addon/builder/fixture-builder-factory.js , im trying to figure out how to differentiate the two cases, so we can camelCase for RESTAdapter, and under_score for ActiveModelAdapter |
They both do the same thing, but they are calling out to get a tranformer for an attribute ( lets say ) .. and that will depend on the adapter type, but the two fixture builders don't have to know what that is. So, for you, you need the payload key ( or something like that ) .. so maybe try and ask the fixtureBuilder ( add a method ? ) because it has the adapter all setup, and then maybe adapter.payloadKey(modelName) might do it. ?? |
yeah ill try that thanks |
Doesn't look like the adapter class has any methods for figuring out the root key, seems like something i can put into fixtureBuilder's, but that means that we may need to introduce an ActiveModelFixtureBuilder instance, that will have a 'payloadKey' that works differently from RESTFixtureBuilder, would that be okay? ActiveModelFixtureBuilder will extend RESTFixtureBuilder and the only different would be the implementation of the new |
Sorry .. I was wrong about adapter, it's serializer http://emberjs.com/api/data/classes/DS.RESTSerializer.html#method_payloadKeyFromModelName |
eb03b6a
to
1e80648
Compare
@danielspaniel updated, thanks for the feedback and help |
Thanks for hanging in there! :) |
convert the root key from
my-model-name
tomy_model_name
so that we access the data properly.See issue #165 for more detail