-
Notifications
You must be signed in to change notification settings - Fork 28
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
emberSync doesn't save to firebase (via EmberFire) #22
Comments
I think your code is wrong. export default Ember.Route.extend({
model: function () {
return this.emberSync.find('user', '2oj9m');
},
actions: {
save: function () {
// do something cool
this.get('content').emberSync.save();
}
}
}); You need to read Ember.js' guide about what |
If after loading application I do this in the console:
I get:
then, when I type this:
I get this:
and then when I type this:
I get this:
Then I go to my firebase dashboard and I see that nothing has been added... However, this: https://github.com/codepreneur/embersync-localforage-example |
@codepreneur did you find a solution to this? I'm running into a similar issue myself. |
@codepreneur @csprocket777 I really don't have a way to debug this, but I'll be helping you with whatever I can. Can you perhaps put some Basically, if your Firebase adapter is similar to I've been using with |
For the record, here are my versions:
So I've been diving into the code to see if I can pin point where my issue is. So far I've narrowed it down to a failing promise in ember-sync.js, The console error states:
Which is caused by a failure to generate relations, from the function "_this.generateRelationForRecord(type, relation);" here: (sorry for the rambling nature, I'm tracing my way through the code) HERE'S THE CULPRIT I see there is a comment on line 638 to "implement for when In fact, removing the relationships from my model allows the online sync to occur. I'm wondering if there was a change in ember-data to ensure that ALL relationships returned promises by default (maybe they always did and I'm thinking wrong). Further clarification, I have my "belongsTo" relationship set to async. Removing the async attribute allows the online sync to work as well. It boils down to the need to handle async relationships. |
@csprocket777 you rock, sir! Do you think you can code a PR to implement this? I'll do it myself but I can't guarantee when. |
Ugh, I'm not sure how to approach implementing a solution. I'm not sure where to implement a promise to solve for this without breaking the whole thing. I'll play around and see if I can solve for this. (I know this is alpha and I'm breaking the "don't use it in production yet" rule, but I'm doing it anyways because this solves a huge issue for me right now, and I'm under the gun) |
@csprocket777 under the gun? 😱 🔫 You can hit me up at #emberjs channel on Freenode if you need. If you can at least write a failing spec in a PR, I'll try to make a patch tonight. |
@csprocket777 from our conversation on IRC, here's a gist with what I think should be done: https://gist.github.com/kurko/7ca3b17fa6b7590b93a1 |
So fetching data from firebase works perfectly (with this.emberSync.find('user', '9nj32')), but trying to save to firebase (via EmberFire) doesn't work and the worst part it doesn't throw any errors.
For example:
with a template:
Any ideas? How would you save to firebase?
P.S. I am also using ember localForage adapter
The text was updated successfully, but these errors were encountered: