Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/64.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 没有将ActiveSupport::SafeBuffer隐式转换为整数_Ruby On Rails_Activeadmin_Partial_Formtastic - Fatal编程技术网

Ruby on rails 没有将ActiveSupport::SafeBuffer隐式转换为整数

Ruby on rails 没有将ActiveSupport::SafeBuffer隐式转换为整数,ruby-on-rails,activeadmin,partial,formtastic,Ruby On Rails,Activeadmin,Partial,Formtastic,这是我的部分\u new\u post.html.haml: = semantic_form_for Post.new, as: :post, url: client_panel_discussion_posts_path(resource), html: { data: { discussion_posts_url: client_panel_active_submission_discussion_url(resource.client_application, id: resource.s

这是我的部分
\u new\u post.html.haml

= semantic_form_for Post.new, as: :post, url: client_panel_discussion_posts_path(resource), html: { data: { discussion_posts_url: client_panel_active_submission_discussion_url(resource.client_application, id: resource.slug) }, multipart: true}, builder: ActiveAdmin::FormBuilder, remote: true, method: :post do |f|
  =f.inputs do
    =f.input :body
    =f.has_many :attachments do |a|
      =a.input :s3_url, as: :hidden, input_html: { class: "s3_url" }
      =a.s3_file_field :attachment, as: :file, class: 'js-s3_file_field'
问题是,我得到了以下错误:
没有将ActiveSupport::SafeBuffer隐式转换为整数
,指向这个
=f

如果我删除
builder:ActiveAdmin::FormBuilder
I get
undefined方法“有很多”for 
错误


有人会遇到这样的情况吗?

没有FormHelper
有很多

看起来,您想要为一个有许多关联的
创建字段。它的助手是
字段\u
尝试:

我没有试过。我不知道s3文件字段


如果你想添加/删除几个附件:这个主题有一个很好的例子,请看一下。

事实上,正如后来发生的那样,解决方案只是运行
bundle update activeadmin

嘿,谢谢回复!!这是我的愚蠢-我尝试了字段,而不是字段:D仍然不工作,它没有显示任何内容,没有添加任何html-好像没有编写任何代码。你已经有任何附件了吗?字段_for不显示新附件的字段(除非您在Post.new上手动生成新附件)是的,我的新操作def show Post=Post.new Post.attachments.build end中有它(不管它是否在show中,因为我在不同的控制器中生成它)我真的想让用户添加附件到帖子中。非常感谢!我将要接受/投票的答案,因为我现在可以看到附加文件的按钮,最后一件重要的事情-我如何才能真正允许用户附加多个附件?我在我的答案中添加了两个涉及此主题的链接。
= semantic_form_for @post, as: :post, url: client_panel_discussion_posts_path(resource), html: { data: { discussion_posts_url: client_panel_active_submission_discussion_url(resource.client_application, id: resource.slug) }, multipart: true}, builder: ActiveAdmin::FormBuilder, remote: true, method: :post do |f|
  =f.inputs do
    =f.input :body
    =f.fields_for :attachments do |a|
      =a.input :s3_url, as: :hidden, input_html: { class: "s3_url" }
      =a.s3_file_field :attachment, as: :file, class: 'js-s3_file_field'