我正在尝试在回形针中添加删除选项。并按照链接删除
我的模型课是
class Asset < ActiveRecord::Base
belongs_to :post
attr_accessible :image
attr_accessor :image_delete
before_save :destroy_image?
has_attached_file :image, :styles => { :medium => "640x480>",
:thumb => "100x100#"},
:storage => :s3,
:s3_credentials => {
:access_key_id => ENV['K1'],
:secret_access_key => ENV['K2']
},
:path => ":attachment/:id/:style.:extension",
:bucket => 'test_local'
private
def destroy_image?
self.image.clear if @image_delete == "1"
end
end
我的表单片段是
<h4>Show Old Images</h4>
<% unless asset_fields.object.new_record? %>
<%= link_to image_tag(asset_fields.object.image.url(:thumb)) %>
<%#= asset_fields.object.delete_asset %>
<%= f.check_box asset_fields.file_field :image_delete, :label => 'Delete Image'%>
<% end %>
错误是得到
undefined method
<input id="post_assets_attributes_1_image_delete" label="Delete Image" name="post[assets_attributes][1][image_delete]" type="file" />' for #<Post:0x00000104e770c0>
什么问题