Skip to content

Instantly share code, notes, and snippets.

def attachment_upload
attachment = Attachment.create(attachment_url: params['file'])
respond_to do |format|
format.json { render json: {url: attachment.attachment_url, id: attachment.id} }
end
end
$(document).ready(function() {
$('#summernote').summernote();
});
$(document).ready(function() {
//upload image in description
$('#email_description').summernote({
height: 300,
onImageUpload: function(files, editor, welEditable) {
for (var i = files.length - 1; i >= 0; i--) {
sendFile(files[i], this);
}
}
});
$(document).ready(function() {
//upload image in description
$('#email_description').summernote({
height: 300,
onImageUpload: function(files, editor, welEditable) {
for (var i = files.length - 1; i >= 0; i--) {
sendFile(files[i], this);
}
}
});
@Archana-p
Archana-p / gist:dac8a0de1ffb2e7feae7
Created January 14, 2016 11:36
summer note attachemt upload
def attachment_upload
attachment = Attachment.create(attachment_url: params['file'])
respond_to do |format|
format.json { render json: {url: attachment.attachment_url, id: attachment.id} }
end
end
def self.remove_attachment(deleted_image_ids)
attachment_ids = JSON.parse(deleted_image_ids)
attachments = Attachment.where(id: attachment_ids)