【发布时间】:2016-03-12 21:54:46
【问题描述】:
这是_image_fields.html.erb中的代码
<div class="nested-fields">
<div class="image-fields"> <%= image_tag f.object.image_url(:thumb) if f.object.image_url.present? %>
<%= f.file_field :image %>
<%= f.hidden_field :image_cache %> </div> <div class="add-language-spacing"> <%= link_to_remove_association 'Remove Image', f, id: 'remove_photo' %> </div>
这是我在 _profile_form.html.erb 中呈现部分的地方
<p id="tag">Add Some Photos!</p>
<div>
<%= f.fields_for :images do |image| %>
<%= render "image_fields", f: image %>
<% end %>
</div>
最后,在 profile/edit.html.erb 中
<div class="profile-form">
<h1 class="page-title">Update Profile</h1>
<%= render 'profile_form' %>
</div>
我的上传器是这样的
# Create different versions of your uploaded files:
process resize_to_fit: [300,300]
version :thumb do
process resize_to_fill: [200,200]
end
拇指版本仅在我按下更新配置文件然后刷新页面后才会显示。无论出于何种原因,当我按下选择文件时,它都不会显示缩略图版本。
【问题讨论】: