0

I am learning to use emberfire but I am having trouble reading data from a database that already exists. In other words, I have an iOS app that uses a firebase database. Data is constantly being changed by users on the iOS app. I am now trying to make a web app, using emberfire, that will read from the same firebase database as the one that the iOS app uses.

The problem is, when I try to use

import Ember from 'ember';

export default Ember.Route.extend({

  model() {
    return this.store.findAll('users');
  }

});

nothing is found. I am wondering if this is because the data was not written to the database from the emberfire app and therefore it is not aware of the data that the iOS app has written to the database. Does this make any sense? Shouldn't the emberfire app know to search the database for 'users' if it doesn't have any saved in the local this.store ?

MikeG
  • 3,745
  • 1
  • 29
  • 51
  • Can you share you model? It sounds like model issue. It has to be singular. `return this.store.findAll('user');` – Askar May 15 '17 at 03:23

2 Answers2

0

try: return this.store.findAll('user');

the problem may be in plural 'users'

  • That doesn't seem to work either. If a `users` model object was never written and saved to the local store, then would EmberFire even "know" to search Firebase for the object? Or would it just search the local store and return with no results since there has never been an object written to the database from this app. – MikeG Apr 24 '17 at 23:01
  • @MikeG has your's config/environment.js ENV.firebase well configured? – Marek Cieślar Apr 25 '17 at 11:50
  • yes it has been configured. I can write data and then read it back without any issue. The problem is that I already have an iOS app running that uses my Firebase database. i want the ember.js app to read from this same database however it won't return anything that wasn't written to the database from the ember app itself. In other words it won't retrieve any values from the database that were written from the iOS app – MikeG May 01 '17 at 16:32
0

You could try using this.store.query('users', {}); and see if it helps.

Otherwise I'd suggest double and triple checking that you are logged in properly in your Ember app (unless your Firebase rules make your data public).

Magnus
  • 17,157
  • 19
  • 104
  • 189