11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/controllers/redactor_rails/documents_controller.rb', line 11
def create
@document = RedactorRails.document_model.new
file = params[:file]
@document.data = RedactorRails::Http.normalize_param(file, request)
if @document.respond_to?(RedactorRails.devise_user)
@document.send("#{RedactorRails.devise_user}=", redactor_current_user)
@document.assetable = redactor_current_user
end
if @document.save
render :text => { :filelink => @document.url, :filename => @document.filename }.to_json
else
render :nothing => true
end
end
|