Ruby on rails 获得;“无”;将PDF/Worddocs上载到应用程序Rails后

Ruby on rails 获得;“无”;将PDF/Worddocs上载到应用程序Rails后,ruby-on-rails,ruby,pdf,paperclip,Ruby On Rails,Ruby,Pdf,Paperclip,因此,我正在构建一个应用程序,用户可以在其中创建Pin并将图片和PDF/Word.docs上传到Pin。似乎我已经尽了一切努力来实现这些选择 在Pins模型中创建的方法: class Pin < ActiveRecord::Base belongs_to :user has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" } v

因此,我正在构建一个应用程序,用户可以在其中创建Pin并将图片和PDF/Word.docs上传到Pin。似乎我已经尽了一切努力来实现这些选择

Pins模型中创建的方法:

class Pin < ActiveRecord::Base
    belongs_to :user
    has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" }
    validates_attachment :image, content_type: { content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"] }
    validates :image, presence: true

    has_attached_file :document
    validates_attachment :document, :content_type => { :content_type => %w(application/pdf application/msword application/vnd.openxmlformats-officedocument.wordprocessingml.document) }

    end

如您所见,PDF的内容为“零”。因此,我想知道它是否真的被保存了,如果没有,我该如何解决这个问题?

您没有解释您是如何“创建”我创建的“PIN”的。让我们慢慢来。给我们所有的信息。你想让我带你通过编码步骤来启用文档上传吗?如果你想。。。我们需要您引导我们了解您在实际导致上述错误时键入和/或单击的内容。即使这对你来说很明显。
class AddFileToPin < ActiveRecord::Migration
  def self.up
    change_table :pins do |t|
      t.attachment :document

    end
  end

  def self.down
    drop_attached_file :pins, :document


  end
end
Pin Load (0.5ms)  SELECT  "pins".* FROM "pins"  WHERE "pins"."id" = ? LIMIT 1  [["id", 3]]
 => #<Pin id: 3, description: "pdf test 2", created_at: "2001-01-01 00:05:13", updated_at: "2001-01-01 00:05:13", user_id: 1, image_file_name: "Screen_Shot_2014-06-25_at_11.45.55_PM.png", image_content_type: "image/png", image_file_size: 45789, image_updated_at: "2001-01-01 00:05:11", document_file_name: nil, document_content_type: nil, document_file_size: nil, document_updated_at: nil>