fix error
This commit is contained in:
parent
c40c552a1d
commit
c1a5e89d57
|
@ -381,8 +381,8 @@ class Admin::GalleriesController < OrbitAdminController
|
|||
if sheet.count <= 203
|
||||
sheet.each_with_index do |row, i|
|
||||
next if i < 3
|
||||
v = row.cells.first.value
|
||||
next if v == "" || v.nil?
|
||||
v = row.cells.first.value rescue nil
|
||||
next if v.blank?
|
||||
import_this_image(row, album)
|
||||
end
|
||||
redirect_to admin_gallery_path(album.id)
|
||||
|
|
|
@ -3,15 +3,14 @@ module Admin::GalleriesHelper
|
|||
value = {}
|
||||
image = AlbumImage.new
|
||||
row.cells.each_with_index do |cell,index|
|
||||
next if cell.nil?
|
||||
val = cell.value
|
||||
next if val.nil? || val == ""
|
||||
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 ""
|
||||
value["en"] = (row.cells[index + 1].value rescue "")
|
||||
image.description_translations = value
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue