2016-08-24 12 views
0

这里是我创造我怎么能uppload图像与carrierwave阿贾克斯

$('.new_book').bind 'ajax:success', (e, data, status, xhr) ->  
    res = $.parseJSON(xhr.responseText)  
    result = createBooks(res)       
    $('.drafts').append(result) 

这里的form_for

=form_for @user.books.new, multipart: true, remote: true, authenticity_token: true, remote: true do |f| 
     p 
     =f.label :title 
     p 
     =f.text_field :title 
     p 
     =f.label :author 
     p 
     =f.text_field :author 
     p 
     =f.label :description 
     p 
     =f.text_area :description 
     p 
     =f.file_field :front 
     p 
     =f.submit 

和控制器

def create 
    @book = Book.new(book_params) 
    @book.user = current_user 
    @book.save 
    respond_to do |format| 
    format.json{ render json: { book: @book } } 
    end  
end 

进出口使用简单carrierwave和recieving未知格式。任何人都可以帮忙吗?

+0

你想要什么样的帮助?为你写代码? –

+0

可能是一些链接或建议。原因我甚至不知道转向 –

+0

的方向问题要求我们推荐或查找书籍,工具,软件库,教程或其他非本地资源,因为它们倾向于吸引自以为是的答案和垃圾邮件,因此无法用于Stack Overflow。 –

回答