configuration.handlebars.templates_root doesn't work like root #34

Closed
pointlessone opened this Issue Apr 12, 2012 · 1 comment

Comments

Projects
None yet
2 participants

A few examples of odd behavior.

The template for our experiments:

template = Ember::Handlebars::Template.new {}
Rails.configuration.handlebars.templates_root = 'app'
t.send :template_path, 'app/templates/app/example' # => "templates/example"

In previous example you can see that all instances of app directory removed, not only the root one.

Rails.configuration.handlebars.templates_root = 'app/templates'
t.send :template_path, 'app/templates/app/example' # => "app/templates/app/example"

In last example root is not removed at all.

Member

tchak commented Apr 12, 2012

yep probably bad naming... Or need to rethink this option. The original use case was not to remove root, but a folder somewhere in the path. In my app I use it like this :

Rails.configuration.handlebars.templates_root = 'templates'
t.send :template_path, 'app/templates/example' # => "app/example"

I understand, that this is confusing and will fix it
The best option is to make it behave as 'root'

tchak closed this in b7f131d Apr 19, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment