scribd_fu gsub 错误
我有一个允许用户将文档上传到 Scribd 的应用程序。我尝试在 Rails 中使用 scribd_fu 。控制器尝试保存模型时发生错误。
NoMethodError in DocumentsController#processupload
private method `gsub' called for nil:NilClass
这是相关的控制器
def processupload
@document = Document.new(params[:document])
if @document.save
session[:scribdid] = @document.ipaper_access_key
else
xxxxx
,这是相关的html表单,
<form action="/documents/processupload" enctype="multipart/form-data" method="post">
<input name="authenticity_token" type="hidden" value="FqTCmlGGIvRjiaiaa+YtF50wgI7FfpxfrZsulLCbXcw=" />
<label class="label_h2">Upload a Document</label>
<input id="document_document_upload" name="document[document_upload]" size="30" type="file" /></div>
<div class="buttons"><button type="submit" class="positive"><img src="/images/icons/tick.png" alt="Save Document"/>Save Document</button>
</form>
有什么问题吗?
I have an application which allow user upload documents to Scribd. I tried to use scribd_fu in Rails. An error occurred when the controller try to save the model.
NoMethodError in DocumentsController#processupload
private method `gsub' called for nil:NilClass
here is the related controller
def processupload
@document = Document.new(params[:document])
if @document.save
session[:scribdid] = @document.ipaper_access_key
else
xxxxx
and this is the related html form
<form action="/documents/processupload" enctype="multipart/form-data" method="post">
<input name="authenticity_token" type="hidden" value="FqTCmlGGIvRjiaiaa+YtF50wgI7FfpxfrZsulLCbXcw=" />
<label class="label_h2">Upload a Document</label>
<input id="document_document_upload" name="document[document_upload]" size="30" type="file" /></div>
<div class="buttons"><button type="submit" class="positive"><img src="/images/icons/tick.png" alt="Save Document"/>Save Document</button>
</form>
Is there anything wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会确保 ScribdFu 支持您尝试上传的文档的 mimetype。这通常是导致错误的最大原因。 (我写了 ScribdFu :))
I'd ensure the mimetype of the document you're trying to upload is supported by ScribdFu. That's usually the biggest cause of an error. (I wrote ScribdFu :))