4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'app/controller/redactor_rails/pictures_controller.rb', line 4
def create
@picture = RedactorRails.picture_model.new
file = params[:file]
@picture.data = RedactorRails::Http.normalize_param(file, request)
@picture.user_id = get_redactor_current_user.try(:id)
@picture.assetable = get_redactor_current_user
if @picture.save
render json: { url: @picture.url(:content), id: @picture.id }
else
render json: { error: @picture.errors, message: @picture.errors.full_messages.join(', ') }
end
end
|