Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive partials #2

Closed
alexishevia opened this issue May 16, 2012 · 2 comments
Closed

Recursive partials #2

alexishevia opened this issue May 16, 2012 · 2 comments

Comments

@alexishevia
Copy link

I'm trying to use the {{> partial_name }} syntax described in http://mustache.github.com/mustache.5.html in order to render a partial within another partial, but I'm getting an error.

This is my view file:

app/views/groups/index.erb

<%= render 'groups/index', :mustache => { :groups => @groups } %>

And this mustache template works without problems:

app/templates/groups/_index.mustache

<ul>
  {{#groups}}
    <li>{{ name }}</li>
  {{/groups}}
</ul>

However, if I split that template in two different files:

app/templates/groups/_index.mustache

<ul>
  {{#groups}}
    {{>group}}
  {{/groups}}
</ul>

app/templates/groups/_group.mustache

<li>{{ name }}</li>

Then I get the following error:

Errno::ENOENT in Groups#index
Showing /home/alexishevia/projects/Tutoriapps/app/templates/groups/_index.mustache where line #1 raised:

No such file or directory - ./group.mustache

@le0pard
Copy link
Member

le0pard commented May 16, 2012

Thanks. We doesn't have such problem, because we doesn't use partials (its little slowdown rendering). I commit little fix for partials, you can try it by adding in Gemfile:

gem 'smt_rails', :git => 'git://github.com/railsware/smt_rails.git'

Now you can use partials in ActiveView and JavaScript. Sample of usage you can find in demo project, source code.

We have one problem for now - it search partials from root of templating directory. We need more time to do it in Rails way, but for now this fix should help you.

@alexishevia
Copy link
Author

Thanks. This works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants