Tag: paperclip padrino

使用Paperclip和Padrino

背景:我正在使用Padrino,Ruby 1.9.2,HAML和Heroku构建一个简单的博客。 我希望post索引具有杂志般的外观。 对于索引中的每个post,用户应该看到标题,内容摘要和图像。 我的问题是附加图像。 问题:我一直在尝试使用Paperclip gem将图像附加到每个post。 Heroku将从Amazon S3 bin中捕获实际图像。 到目前为止,当我尝试运行迁移时,我收到错误: $ …/base.rb:1088:in `method_missing’: undefined method `has_attached_file’ for # (NoMethodError) 看起来像Paperclip只是不会加载,但是我被卡住了。 详细信息: – 问:当我“尝试运行迁移”时,我在做什么? – 答:我将以下内容放入迁移文件夹中 class AddPictureToPost < ActiveRecord::Migration def self.up change_table :posts do |t| t.has_attached_file :picture end end def self.down drop_attached_file :posts, :picture end end 然后运行“padrino rake ar:migrate” – 问:我是否在Gemfile中列出了Paperclip? – A:是的。 – […]