Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.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 简单表单下拉菜单,字符串选择_Ruby On Rails_Ruby On Rails 4_Simple Form - Fatal编程技术网

Ruby on rails 简单表单下拉菜单,字符串选择

Ruby on rails 简单表单下拉菜单,字符串选择,ruby-on-rails,ruby-on-rails-4,simple-form,Ruby On Rails,Ruby On Rails 4,Simple Form,我在rails 4应用程序中使用简单表单 我的应用程序中有一个带有此位置标识符的显示页面: <div class="datasubtextq">Location: <span class="datasubtexta"> <% if @project.scope.try(:participant).try(:location_specific) == true %> <%= render @pro

我在rails 4应用程序中使用简单表单

我的应用程序中有一个带有此位置标识符的显示页面:

<div class="datasubtextq">Location:
        <span class="datasubtexta">
          <% if @project.scope.try(:participant).try(:location_specific) == true %>
            <%= render @project.scope.try(:participant).try(:location) %>
          <% else %>
            <%= render :text => "Remote participation sought" %>
          <% end %>
        </span>
  </div>
我如何要求展示表格反映表格中的位置选择


谢谢

如果您阅读了收到的错误,您可以看到问题与尝试渲染不存在且正常的部分有关,以修复问题更改

<%= render @project.scope.try(:participant).try(:location) %>



根据错误,您正在尝试渲染“Brisbane”,这是
try(:location)
的结果,是否有名为
Brisbane
的部分?我猜你想把你的表格呈现出来,对吧?因此,更改
render@project….
类似于
render'your_form'
No-我没有称为布里斯班的部分。布里斯班是表格中选项集合中的一个选项。
The partial name (Brisbane) is not a valid Ruby identifier; make sure your partial name starts with a lowercase letter or underscore, and is followed by any combination of letters, numbers and underscores.
<%= render @project.scope.try(:participant).try(:location) %>
<%= @project.scope.try(:participant).try(:location) %>