Insert record in mysql

Hello All

i want to insert multiple record in 1 column.

i upload multiple image it’s name i want to store for ex.
a.jpg,b.gif,c.png like this

my html code is like this

Image : <%= f.file_field :image,:name => "service[image0]" %><% f.file_field :image, :type => 'hidden', :id => 'image1'%>

and only controller change require but i have no idea

my controller

def create
for i in count(params[:image])
puts i
end
exit
@path =
File.join("#{RAILS_ROOT}/public/images/",params[:service][:image].original_filename)
File.open(@path, “wb”){|f| f.write(params[:service][:image].read)}
params[:service][“user_id”] = session[:user_id]
@service = Service.new(params[:service])
@service.image=params[:service][:image].original_filename

  respond_to do |format|
      if @service.save
         flash[:notice] = 'Service was successfully created.'
         format.html { redirect_to(users_url) }
         format.xml  { render :xml => @service, :status => :created,

:location => @service }
else
format.html { render :action => “new” }
format.xml { render :xml => @service.errors, :status =>
:unprocessable_entity }
end
end
end

i got array like this

image0 => file1 with path
image1 => file1 with path
image2 => file2 with path
but i want store whole in image field separating comma

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