Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 回形针上传的文件给出了;can';t转储文件";当添加到会话时_Ruby On Rails 4_Paperclip - Fatal编程技术网

Ruby on rails 4 回形针上传的文件给出了;can';t转储文件";当添加到会话时

Ruby on rails 4 回形针上传的文件给出了;can';t转储文件";当添加到会话时,ruby-on-rails-4,paperclip,Ruby On Rails 4,Paperclip,我需要上传的回形针文件在多步骤的形式。我在会话中通过了相同的测试,但它给了我“无法转储文件” 我的控制器中有以下方法: def find_shared_ids session[:attachment] = params[:participant_attachments][:attachment] @file_title = params[:participant_attachments][:file_title] @attachment = ParticipantAttachme

我需要上传的回形针文件在多步骤的形式。我在会话中通过了相同的测试,但它给了我“无法转储文件”

我的控制器中有以下方法:

def find_shared_ids
  session[:attachment] = params[:participant_attachments][:attachment]  
  @file_title = params[:participant_attachments][:file_title]
  @attachment = ParticipantAttachment.new(activity_params)
end
以下是我的模型:

class ParticipantAttachment < ActiveRecord::Base
  belongs_to :participant
  has_many :shared_attachments, dependent: :destroy
  has_many :participants, through: :shared_attachments
  validates_presence_of :attachment

  has_attached_file :attachment, Paperclip::Attachment.default_options.merge(Settings.participant_attachments.paperclip)

  validates_attachment_content_type :attachment, content_type: ['image/jpeg']
end
class participanttachment
我在浏览器上获得以下信息:

无法转储文件

参数:

{“utf8”=>“✓", “真实性令牌”=>“D4CK467KQL0GOJ2Y5HWRDxMI1DCDBU6TULZMMUFPOG=“, “参与者附件”=>{“附件”=>\, @原始_filename=“1505352_796594563718005_3237802925919628295_n.jpg”, @content_type=“image/jpeg”,@headers=“内容处理:表单数据; 姓名=\“参与者附件[附件]\”; 文件名=\“1505352\u 796594563718005\u 3237802925919628295\u n.jpg\”\r\n内容类型: image/jpeg\r\n“>,“文件标题”=>“refesf”},“参与者ID”=>“”

我尝试在我的视图文件中传递相同的in hidden_field_标记。它将上载的文件作为字符串,没有帮助


请帮忙!:)

你能发布你的表单是什么样的吗?我想你需要在你的
表单中添加“:html=>{:multipart=>true}`以获得
但我不能确定