2011-07-29 115 views
21

我有一种看法,依赖于几个partials。为了将这些部分分组,我将它们移到了一个子文件夹中,但是当我调用部分时,我得到一个Missing template client_demographics/_age.erb in view path app/views错误。Partial分组在子文件夹中

我的谐音文件夹结构:

app 
    views 
    reports 
     client_demographics 
     _age.html.haml 
     _gender.html.haml 
     client_demographics.html.haml 

如何,我调用部分在我看来:

= render :partial => "client_demographics/age" 

回答

54

您将需要使用路径从app/views文件夹

= render :partial => "reports/client_demographics/age" 
+1

谢谢!我无法相信我错过了那么明显的东西! – Coderama

+1

顺便说一下,您现在可以在Rails 4+中执行'render“reports/client_demographics/age”'。不需要':部分' –

相关问题