Ruby on rails 轨道4-命名测角器

Ruby on rails 轨道4-命名测角器,ruby-on-rails,amazon-s3,nomethoderror,Ruby On Rails,Amazon S3,Nomethoderror,我使用回形针、AWS和s3_direct_upload gems上传简单图像。我将在这里学习本教程: 该文件已成功上载到S3,但在后处理过程中,出现以下错误: Completed 500 Internal Server Error in 973ms NoMethodError (undefined method `upload_file_name=' for #<Choice:0x007f9ea60e02d0>): app/models/choice.rb:60:in

我使用回形针、AWS和s3_direct_upload gems上传简单图像。我将在这里学习本教程:

该文件已成功上载到S3,但在后处理过程中,出现以下错误:

  Completed 500 Internal Server Error in 973ms

  NoMethodError (undefined method `upload_file_name=' for #<Choice:0x007f9ea60e02d0>):
   app/models/choice.rb:60:in `set_upload_attributes'
   app/controllers/choices_controller.rb:24:in `create'
在973ms内完成500个内部服务器错误
NoMethodError(对于#的未定义方法“upload_file_name=”):
app/models/choice.rb:60:in'set\u upload\u attributes'
app/controllers/choices_controller.rb:24:in'create'
下面是我的模型(“选择”)的样子,其中应定义
上传文件\u名称


你知道我做错了什么吗?非常感谢

您是否运行了迁移。如果数据库中的表中不存在该列,则会出现该错误。

您的代码看起来很漂亮、干净、风格很好。可能您没有在生产环境中运行迁移,也没有在之后重新启动服务器以获取列更改。结果表明,我的一些代码使用了错误的方法,例如,第60行应该是
self.picture\u file\u name
而不是
self.upload\u filename
。你的帖子让我查了一下列名。谢谢