module Admin::GalleriesHelper def import_this_image(row,album) value = {} image = AlbumImage.new image.album = album row.cells.each_with_index do |cell,index| val = cell.value rescue nil next if val.blank? case index when 0 image.remote_file_url = val when 1 value["zh_tw"] = val value["en"] = (row.cells[index + 1].value rescue "") image.description_translations = value end end image.save end end