What's the simplest way to use Ember.js for just one part of a Rails application?
I would like to create a Rails application with a full set of admins, authentication, authorization, etc., which is pure Rails, but I would like there to be one part of the application that is "live" and where the view is bound to data, and I would like to use Ember for that.
For example, I have a model Company
that has_many Parties
and Party has_many Guests
. I would like to User
be able to log in, go to the page Company
they have access to and click on the link to Company/:id/Party/:id/live
, which will be a page with an image of an Ember.js app that offers details of everyone Guests
in the batch. It will query the database every X seconds, and the Ember.js app will automatically reflect the updated data (for example, one section of the page only displays Guests where Guest.status == in_attendance
or something like that).
So my question is, is there a standardized or proven way to include Ember in part of a Rails application in this way?
Thank!
To implement an Ember app, you must do two things:
- Change the root element from
body
to something else. - Disable url management
Code examples:
App = Ember.Application.create({
rootElement: '#app'
});
App.Router = Ember.Router.extend({
location: 'none'
});
I took this information from Ember Guides: Application Implementation