Hi all…
Admittedly I’m new to Rails and trying to find my way but I’m having
an issue with uploading documents with attachment_fu.
I have a form where I’m uploading multiple attachments (using AJAX to
add file_filed_tags). That seems to work pretty well. The problem is
I can’t seem to get the content_type to work as I would expect. For
example, if I use this:
has_attachment :content_type => [‘application/pdf’, ‘application/
msword’, ‘text/plain’]
I would expect I can upload .pdf, .doc and .txt files but I get and
Document is invalid error (document is the name of my model) I have
played around with different content_types but I can’t seem to get
consistent results.
Thanks for any help.
- Mark
Here is the document model
class Document < ActiveRecord::Base
belongs_to :tournament, :polymorphic => true
has_attachment :content_type => [‘application/pdf’, ‘application/
msword’, ‘text/plain’],
:storage => :file_system,
:max_size => 1.megabyte
validates_as_attachment
end