Ruby on rails 简单表单下拉菜单,字符串选择
我在rails 4应用程序中使用简单表单 我的应用程序中有一个带有此位置标识符的显示页面: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
<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) %>