Displaying 1 result from an estimated 1 matches for "save_image_number".
Did you mean:
saved_image_number
2006 Mar 05
2
How to clean up this code?
...controller ----
def new
@product = Product.new
@file_fields_no = 4
@file_fields_no.times do @product.images << Image.new end
end
def create
@product = Product.new(params[:property])
if @product.save
uploaded_image_number = 0 # number of the uploaded file
save_image_number = 0 # number of the file that will be saved
on the disk
# for every image
params[:images].length.times do
# check if it was sent
if(params[:images][uploaded_image_number.to_s][:image_url].size
!= 0)
# don''t know yet how to get file extension :)...