0

我已经查看了整个互联网,试图找出为什么这个错误发生在我身上。我正在尝试使用 Rails 3.2.7 中的回形针 gem 上传文件并给我这个错误:

NoMethodError in ItemsController#create

undefined method `match' for nil:NilClass

Rails.root: C:/Users/AC_37-PC_BH/RubymineProjects/railstutorial-sample_app_2nd_ed-815d98a

app/controllers/items_controller.rb:20:in `new'
app/controllers/items_controller.rb:20:in `create'

Request

Parameters:

{"utf8"=>"✓",
 "authenticity_token"=>"oYc/V2xKpJVKXPukjrjzQJAboOxI27YXPI42sfDHYaA=",
 "item"=>{"item_name"=>"",
 "item_pic"=>#<ActionDispatch::Http::UploadedFile:0x3c36678 @original_filename="197623_10150112121221032_1900156_n.jpg",
 @content_type="image/jpeg",
 @headers="Content-Disposition: form-data; name=\"item[item_pic]\"; filename=\"197623_10150112121221032_1900156_n.jpg\"\r\nContent-Type: image/jpeg\r\n",
 @tempfile=#<File:C:/Users/AC_37-~1/AppData/Local/Temp/RackMultipart20120801-6096-q8c9v0>>},
 "commit"=>"Create my account"}

我在项目中包含了一个 github,所以你们可以测试它。并尝试看看出了什么问题。您必须手动访问 localhost:3000/items/new 才能看到该页面

https://github.com/vinchbr/demo_app

所有帮助将不胜感激 =)

4

1 回答 1

0

您需要放入Gemfile

以下代码:

gem 'paperclip', '3.0.4'
于 2012-08-02T14:22:13.760 回答