i have a problem with upload photos.
In muy view, i take some photo as below:
<%= f.label :images_urls, 'image' %> <br>
<%= f.file_field :images_urls, {:multiple => true} %> <br>
But I don't know how save them in controller to my model "Furniture". This is my furniture, but i don't work:
def create
image_io = params[:furniture][:images_urls]
File.open(Rails.root.join('public','furnitures', image_io.original_filename), 'wb') do |file|
file.write(image_io.read)
end
@furniture = Furniture.create(params[:furniture])
redirect_to admins_path
end
Have you any suggestion??
Thank you very much