File is not getting saved using paperclip

Hi all I have a form which contains attachments but the attachment is
not getting created in file system and the fields for the attachment
in DB is not getting filled when a new form is created .

I’m using paperclip

I hope the problem is with view part html=>:multipart (as I’m using a
single form to create multiple instances)

My Controller:

def create
respond_to do |format|
if @ins.all?(&:valid?)

 format.html { redirect_to :action => 'index'}

    format.html {render :action => 'new'}



def new
@ins ={}

My view:

<%= form_tag({:action => :create}, {:multipart => true}) %>
<% @ins.each_with_index do |ins, index| %>
<% fields_for “ins[#{index}]”, ins do |f| %>
<%= f.text_field :pol_number%>
<%= f.file_field :attachment%>
<% end %>

<% end %>
<%= submit_tag “Save”%>

My Model:

class InsPol < ActiveRecord::Base
has_attached_file :attachment


Moreover i have All the db migration for this attachment using
paperclip and paperclip installed properly

Plz help me in this regard

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs