Rails .erb文件呈现错误的顺序

时间:2015-11-29 04:38:11

标签: ruby-on-rails twitter-bootstrap erb

我有以下.erb文件:

.TagDescriptions[] | select(
    .Tags | from_entries | [
        .service == "widget",
        .environment == "production",
        .customer_prefix == "widget_xyz"
    ] | all
).LoadBalancerName

<div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th>Name</th> <th>Email</th> <th>Delete</th> </tr> </thead> <tbody> <%= form_for @group, html: { id: 'form' } do |group_form| %> <div id="group-members"> <%= group_form.fields_for :group_members do |group_member_fields| %> <tr> <td><%= group_member_fields.text_field :name , class: 'form-control' %></td> <td><%= group_member_fields.email_field :email, class: 'form-control' %></td> <td><%= group_member_fields.check_box :_destroy %></td> </tr> <% end %> </div> </tbody> </table> </div> <%= group_form.submit 'Apply', class: "btn btn-success btn-sm pull-right" %> <% end %> <!-- End of form --> <%= submit_tag 'Add member', type: 'button', class: "btn btn-primary btn-md", id: "add-member-to-group-btn" %> div form_for id group-members fields_for group-members div的{​​{1}}呈现空白且位置错误。 https://github.com/nickvane/Magento-RestApi/wiki/Authentication-steps 中的元素仍然可以正常呈现,而不是在https://github.com/nickvane/Magento-RestApi 内。

enter image description here

2 个答案:

答案 0 :(得分:2)

只允许<tr>个元素作为<tbody>的子元素。您应该在表单内移动表格。然后,您可以将属性id="group-members"移动到其他元素,例如<form><tbody><table>

答案 1 :(得分:1)

在HTML中,如果您想在<div>中使用<table>标记,则该标记必须位于<th><td>。有关详细信息,请查看此处的帖子:

https://css-tricks.com/using-divs-inside-tables/