views:

67

answers:

1

now i am trying to upload a pdf file to the server ,but i get nothing,when i try to get the url of the attached file,i got some missing.png file name. Is there some where i can set to tell the paperclip that i just want to upload pdf files but not pictures? great thanks... here is my class settings

============================================model file
class RdBenefit < ActiveRecord::Base
  belongs_to :reim_detail  
  has_attached_file :details
  validates_attachment_content_type :doc, :content_type => ['application/doc'] 
end

======================================schema
  create_table "rd_benefits", :force => true do |t|
    t.integer  "sequence"
    t.date     "reim_date"
    t.integer  "fee_time_span"
    t.integer  "people_count"
    t.decimal  "amount",               :precision => 10, :scale => 0
    t.integer  "reim_detail_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "details_file_name"
    t.string   "details_content_type"
    t.integer  "details_file_size"
    t.datetime "details_updated_at"
  end


==========================gemfile
gem "paperclip"


=========================view file
<%= form_for @doc_head,:remote=>true,:html => { :multipart => true } do |f| %>
+1  A: 

Paperclip works with Rails3.

If you want to limit your attachment just to PDF's, you should set up validation on your attachment like this:

validates_attachment_content_type :pdf, :content_type => ['application/pdf'] 
Igor Pavelek
well here is my class but it doesn't work
29decibel
What exactly doesn't work?
Igor Pavelek
i can't find any error messages and i got no uploaded file in my public directory
29decibel
well my model which has attachment is a nested model with other,in the console it only shows [paperclip] saving attachments...but i got nothing
29decibel