Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/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 简单的“U形”表示“带”的失败;can';t写入未知属性`builder'&引用;_Ruby On Rails_Simple Form - Fatal编程技术网

Ruby on rails 简单的“U形”表示“带”的失败;can';t写入未知属性`builder'&引用;

Ruby on rails 简单的“U形”表示“带”的失败;can';t写入未知属性`builder'&引用;,ruby-on-rails,simple-form,Ruby On Rails,Simple Form,我有一个帖子模型,与评论模型有一对多的关系。我正在部分使用simple_表单为我的用户界面创建一些快速表单(特别是注释模型): <%= simple_form_for(@post, Comment.new) do |f| %> <%= f.error_notification %> <div class="form-inputs"> <%= f.input :comment, :input_html => {:rows =>

我有一个帖子模型,与评论模型有一对多的关系。我正在部分使用simple_表单为我的用户界面创建一些快速表单(特别是注释模型):

<%= simple_form_for(@post, Comment.new) do |f| %>
  <%= f.error_notification %>

  <div class="form-inputs">
    <%= f.input :comment, :input_html => {:rows => 20, :class => 'span12'} %>
  </div>

  <div class="form-actions">
    <%= f.button :submit %>
  </div>
<% end %>

{:行=>20,:类=>'span12'}%>
但是,Rails失败并出现以下错误:
无法写入未知属性“builder”
和指向第一行的堆栈跟踪(


此生成器属性来自何处,如何使其工作?谢谢。

我猜您使用的是
嵌套资源。如果是这样,那么您应该将数组作为第一个参数传递给
方法的
simple\u form\u(负责设置正确的表单URL):


真管用!我知道这一定是我错过的简单的东西。谢谢
<%= simple_form_for [@post, Comment.new] do |f| %>