Reputation: 619
I have 6 image fields in a model. (img1, img2, img3, img4, img5, img6) When I upload images to all these 6 fields and then display their values they all show the uploaded image name. Except for img6 field. This is what it is showing:-
ActionDispatch::Http::UploadedFile:0x007f51c0d88a88
I have checked all fields they are strings.
Can anyone please let me know what can be the possible cause? Here is the form:-
<%= form_for(@product, :html => { :multipart => true }, :remote => true) do |f| %>
<div id="addImages">
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<%= label :image1, "Main image" %>
<%= f.file_field :img1 %>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<%= label :image2, "2nd image" %> (Optional)
<%= f.file_field :img2 %>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<%= label :image3, "3rd image" %> (Optional)
<%= f.file_field :img3 %>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<%= label :image4, "4th image" %> (Optional)
<%= f.file_field :img4 %>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<%= label :image5, "5th image" %> (Optional)
<%= f.file_field :img5 %>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<%= label :image6, "6th image" %> (Optional)
<%= f.file_field :img6 %>
</div>
<div class="clearfix"></div>
</div>
<div>
<%= f.submit class: "btn btn-default btn-lg" do %><b>Submit Product</b><% end %>
</div>
One thing I forgot to tell. img6 field was previously thumbnail. I renamed this column to img6.
Upvotes: 2
Views: 1349
Reputation: 619
Sorry. Forgot to add this to model
mount_uploader :img6, ProductUploader
my bad
Upvotes: 9