4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/controller/redactor2_rails/images_controller.rb', line 4
def create
@image = Redactor2Rails.image_model.new
file = params[:file]
@image.data = Redactor2Rails::Http.normalize_param(file, request)
if @image.has_attribute?(:"#{Redactor2Rails.devise_user_key}")
@image.send("#{Redactor2Rails.devise_user}=", redactor2_current_user)
@image.assetable = redactor2_current_user
end
if @image.save
render json: { id: @image.id, url: @image.url(:content) }
else
render json: { error: @image.errors }
end
end
|