Convert App From EmberFire to Fireplace
There are a few changes required to convert your Ember app from using EmberFire to Fireplace. Here are a few that I found to be required. There are probably more.
I was using EmberFire with ember-data first. It worked pretty well. I ran into a few hiccups where it seemed like model relationships weren’t working quite right in a couple places, but I worked around it for my simple app. Fireplace was recommended to me as a good option instead of EmberFire. From those that know more about this than I do, Fireplace was described as “the thing that ember-data should have been,” and way more capable than EmberFire. As far as I can tell, they look very similar. But, if you should want to switch, here are the basic changes:
Set the Store
Instead of setting up an adapter for Firebase to work with Ember data, you want to define a store on your app. That might look like this:
App.Store = FP.Store.extend firebaseRoot: 'https://myfirebase.firebaseio.com'
Note that the store is of type
FP.Store instead of
Now that you have another store set, you want to make sure you remove ember-data so it doesn’t try to interact with it. If you forget, you will get an error at runtime:
Uncaught Error: Assertion Failed: The initializer 'store' has already been registered
Ember-data comes bundled with ember-inflector. But, now that ember-data is gone, we need to fetch this library separately. This is the library responsible for inferring types in your models based on property names. To get it, you’ll need the ember-inflector source. You’ll notice that there isn’t a nice package built for you. Instead, you’ll have to build it with Ruby tools.
To make your own version from source, follow these steps:
git clone [email protected]:stefanpenner/ember-inflector.git rake bundle rake dist cp dist/modules/ember-inflector.js your_project_dir
For convenience, at the risk of being out-dated, I’ve uploaded the version that I built as of 17 Mar 2014 to a gist of ember-inflector at 32e30eb.`
Change Model Definitions
Your models will need to change, but not by much.
FP.attr. The changes are pretty much one-to-one in requiring just a namespace change.
Optionally Change Finds
Where you use ember-data’s
model.find function, you may want to change to use Fireplace’s
fetch, in this case will return a promise where
find does not.
Beyond the above, only API that broke for me was ember-data’s
model.destroyRecord. It seems on that this is the different, because
createRecord remain the same. But, for the delete, the API becomes simply
The app I converted was quite simple, so I’m thinking that there will be other changes required. What have you run into?