I’m making some progress but I can’t figure out the error…
If I comment out this line in attachment_fu.rb my files upload but their file size in the table is 0 (zero). If i uncomment the code the upload fails with an invail field error. I have noticed that the code seems to work on small files. <16k
validates the size and content_type attributes according to the current model’s options
def attachment_attributes_valid?
[:size, :content_type].each do |attr_name| enum = attachment_options[attr_name]
errors.add attr_name, ActiveRecord::Errors.default_error_messages[:inclusion] unless enum.nil? || enum.include?(send(attr_name))
end end
This is what I’m doing to upload the files
Save the uploaded files
params[
:documents].each do |doc|
@tournament.documents << Document.new(:uploaded_data => doc)
end unless params[:documents].nil?