Jdstor第一部分后台设计,4-4上传图片。
3.4 Using Partials--3.4.4 Passing Local Variables
You can also pass local variables into partials, making them even more powerful and flexible.
show.html.erb:
<%= render partial:"image", locals:{product:@product} %>
_image.html.erb:
<% if product.image.present? %>
<%= image_tag(product.image.thumb.url, class:"thumbnail")%>
<% else %>
<%= image_tag("http://placehold.it/200x200&text=No Pic",class:"thumbnail")%>
<% end %>
http://upload.cnblogs.com/ImageUploader/Upload?host=www.cnblogs.com&editor=2
错误:
1. 我在admin/index.html中,想使用partial上传图片。但发生?。
时间: 2024-10-10 08:41:18