fix upload image error
This commit is contained in:
parent
5cd65d997f
commit
f150f95379
|
@ -39,7 +39,7 @@ class Admin::RulingTemplatesController < OrbitAdminController
|
|||
image = TemplateImageFile.new(template_image_params)
|
||||
image.order = (template.template_image_files.max(:order) + 1 rescue 0)
|
||||
image.r_template = template
|
||||
image.save
|
||||
image.save!
|
||||
render :json => {"files" => [{"thumbnail_url"=>image.image_file.thumb.url}]}.to_json
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class TemplateImageFile
|
||||
require "ostruct"
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
|
@ -7,4 +8,25 @@ class TemplateImageFile
|
|||
field :order, :type => Integer, :default => 0
|
||||
|
||||
belongs_to :r_template
|
||||
|
||||
def album_crops
|
||||
[]
|
||||
end
|
||||
|
||||
def file
|
||||
self.image_file
|
||||
end
|
||||
def album
|
||||
tmp = OpenStruct.new
|
||||
tmp.album_colors = album_colors
|
||||
tmp.resize_gravity = 'Center'
|
||||
tmp
|
||||
end
|
||||
|
||||
def album_id
|
||||
nil
|
||||
end
|
||||
def album_colors
|
||||
[{'color' => 'transparent'}]
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue