开发者

rails 3 ActionView::Template::Error (no block given (yield))

开发者 https://www.devze.com 2023-03-29 19:17 出处:网络
This code was working in rails 2.3.X...but it return this error in rails 3.0.9 ActionView::Template::Error (no block given (yield)):

This code was working in rails 2.3.X...but it return this error in rails 3.0.9

ActionView::Template::Error (no block given (yield)):
7:            <%= yield %>
app/views/colones/_colone.html.erb:7:in `_app_views_colones__colone_html_erb__407265174181794185_76812160_3109567765965463980'

It work if i call yield from layout or by with a locals (partial) like that

<%= render :partial => 'colones/colone', :locals => { :colone => @colones.first } %>

but i开发者_如何学Pythonf failed when I try :

<%= render @colones %>

or

<%= render :partial => 'colones/colone', :collection => @colones %>

If should have another way to accomplish that because the only thing I found to work around is very ugly:

<%= render :partial => 'colones/colone', :locals => { :colone => @colones.first %>
<%= render :partial => 'colones/colone', :locals => { :colone => @colones.second %>

I think it's a part of this problem but I'm not 100% sure ... I'll try to pass a collection

Someone have any suggestion or explaination on how to solve this ERROR?

thank you

0

精彩评论

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