ここに私の _form.html.erb の添付コードがあります
<div class="control-group">
<%= f.label :attachment , :class => 'control-label' %>
<div class="controls">
<%= f.file_field :attachment, :class => 'file_field', multiple: 'true' %>
</div>
</div>
ここに私のモデルinvoice_details.rbがあります
class InvoiceDetail < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader
#validates :invoice_number, :supplier_name, :attachment, presence: true # Make sure the owner's name is present.
#validates_uniqueness_of :invoice_number
#validates :invoice_number, length: { maximum: 7 }
#validates :supplier_name, length: { maximum: 20 }
#validates :description_of_goods, length: { maximum: 50 }
#validates :quatity, numericality: true
#validates :price_per_unit, numericality: true
#validates :total_amount, numericality: true
end
ここに別のモデルinvoice_file.rb
class InvoiceFile < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader # Tells rails to use this uploader for this model.
validates :name, presence: true # Make sure the owner's name is present.
end