首页 > 其他 > 详细

12月10日 render( locals:{...}) 传入本地变量。

时间:2017-12-10 10:21:49      阅读:257      评论:0      收藏:0      [点我收藏+]

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上传图片。但发生?。 

12月10日 render( locals:{...}) 传入本地变量。

原文:http://www.cnblogs.com/chentianwei/p/8016223.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!