HI 
   
  Firstly we need install paperclip, imagemagic on your machine , then we 
need define relation to the model suppose product and product_images. we 
need to define accepts_nested_attributes_for :product_images in your model 
then
 
 when you create object of model we need build product object to the 
product_iamges model.

In your view create _form.html.erb and _product_image_fields.html.erb.

In your form.html.erb write above code 









* <div class="control-group">      <label class = "control-label">Select 
image<abbr title="required">*</abbr></label>        <%= f.fields_for 
:product_images do |builder| %>          <%= render 'product_image_fields', 
:f => builder %>        <% end %>      <div class="controls">        <%= 
link_to_add_fields "Browse more image", f, :product_images %></p>      
</div>    </div>*  
And your product_images.html.erb write above code
*<div>*











*  <%= f.file_field :photo %>    <span>      <%= f.check_box 
:default_image, {checked: false}  %>      Default Image    </span>    
<span>&nbsp;<%= link_to_remove_fields "remove", f %></span>  </div> *This 
code work perfectly to me...

On Tuesday, April 29, 2014 2:40:37 AM UTC+5:30, Eugeniu Tambur wrote:
>
> Hello, I'm learning rails and creating a small project, 
> Someone could tell me how can I upload multiple images with paperclip in 
> rails 4? 
>
> Thank you very much, I hope someone can help me. 
> Greetings.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/805183b7-14ba-4fda-9e46-04ef60970de9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to