Sharing templates between Rails and Ember


#1

I wondered if anyone had tried to share templates between Rails and Ember. In our case the Ember app is an edit interface to users content and that content is rendered by a Rails app for non admin users. We have so far managed to get away with minimal template replication between Rails & Ember but there is starting to be some pieces which I would much rather re-use, e.g. is it possible to have a setup like so:

Rails view (app/views/foo/_show.hbs):

<div class="foo-name">{{name}}</div>
<!-- lots more markup -->

Rendered via Rails, has access to a @foo instance variable or something

And then have a Ember template (app/assets/javascripts/admin/templates/foo.ember.hbs.erb) that does something like:

<%= File.read(Rails.root.join('app', 'views', 'foo', '_show.hbs')) %>