How can I specify an alternative directory for my HandlebarsJS templates with the ember-rails gem?

浪尽此生 提交于 2019-12-05 05:16:43

You're right that you need to set templates_root. Try adding

config.handlebars.templates_root = 'embro/templates'

to the configuration block in application.rb, or

RailsApp::Application.config.handlebars.templates_root = 'embro/templates/'

to a new initializer, where RailsApp is whatever your application is named.

Edit:

I was able to reproduce the behaviour that you described with templates_root. The fix for me was to delete the /tmp folder of my application and restart rails. After that, the templates were named correctly.

Edit:

More precisely, you need to clear the sprockets cache at /tmp/cache/assets after changing templates_root.

Edit:

As mentioned in the comments below, a simple rake tmp:cache:clear should take care of the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!