ruby on rails – paperclip – nohandleerror – 找不到处理程序

我有一个用于发布内容的应用程序。 我希望用户能够向我写反馈,并希望他们能够上传截图。

我自己写了一个模型,控制器和东西。

 Name Topic  Bug Suggestion Other  Screenshot  Message  
$(document).ready(function () { var msg = document.getElementById('feedback-message'); var submit = $('#submit-feedback'); submit.click(function () { msg.style.display = 'block'; submit.prop('disabled', true); setTimeout(function () { submit.prop('disabled', false); msg.style.display = 'none'; }, 5000); $.ajax({ url: '/feedback', type: 'POST', data: { authenticity_token: $('[name="authenticity_token"]').val(), name: $('#name').val(), message: $('#message').val(), topic: $('#topic').val(), screenshot: $('#upload_input').val(), }, }); }); });

我通过单击按钮显示它(显示为模态)。

在我尝试实现屏幕截图之前工作正常。 遵循回形针的安装指南,并在提交表格时提供

 Paperclip::AdapterRegistry::NoHandlerError - No handler found for "C:\\fakepath\\wahtdihdijustread.jpeg": app/controllers/feedback_controller.rb:6:in `create' 

编辑:

 class Feedback < ApplicationRecord validates :name, presence: true, length: {minimum: 3} validates :message, presence: true, length: {minimum: 5} validates :topic, length: {minimum: 3} has_attached_file :screenshot, path: '/feedback/:filename', url: '/feedback/:filename' validates_attachment_content_type :screenshot, content_type: /^image\/(jpg|jpeg|png)$/, message: 'file type is not allowed (only jpg/jpeg/png images)' end 

EDIT2:

 class FeedbackController < ApplicationController def index; end def create Feedback.create name: params[:name], message: params[:message], topic: params[:topic], screenshot: params[:screenshot] authorize Feedback end end