Ember Components and ember-rails gem


#1

How and where do you define a component handlebars file in ember-rails? More generally, is it possible to create arbitrary handlebars files outside of the conventional folder structure?

I posted an issue on github.

If this is not defined functionality yet, does somebody know of a potential workaround?


#2

Was a dummy, forgot to move “components” folder under the templates folder.

However now my question is how do you pass a whole object structure to the component via handlebars.

For example:

Assuming a component that looks like this

<h2> Search Result </h2>
<ul>
<li>Foo: {{ foo }} </li>
<li>Bar: {{ bar }} </li>
<li>Baz: {{ baz }} </li>
</il>

Is it possible to pass a whole object

{{#each result in model}}
   {{search-result result}}
{{/each}}

and have the component template look like

<h2> Search Result </h2>
<ul>
<li>Foo: {{ result.foo }} </li>
<li>Bar: {{ result.bar }} </li>
<li>Baz: {{ result.baz }} </li>
</il>

instead of

{{#each}}
   {{ search-result foo=foo bar=bar baz=baz }}
{{/each}}

Is this a handlebars limitation?