开发者

Rails 3 render :partials

I am migrating my 1.8.7 rails app to rails 3. But I have a problem with a partial: I have the following partial:

in my cms controller :

@clients 开发者_Go百科= Client.all

group = render_to_string :layout => 'layouts/window', :partial => 'clients/index'

in my "clients/index" partial:

<%= render :partial => 'clients/item', :collection => @clients %>

This worked great with rails 1.7.8 but with rails 3 only the partial in the index get's rendered!. So, to clarify this, the group variable in the controller doesn't get the html from the layout. Also the weird thing is that the window layout is _window.erb (if I do window.html.erb or just window.erb rails can't find it which is strange).

Does anybody know if this behavior is normal for rails 3?

thanxs!


Partials in rails have to start with underscore. Try renaming your "item.html.erb" partial to "_item.html.erb".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜