0

这是我的表单视图代码:

<div class="row">
  <%= semantic_form_for @new_athlete_sport, :remote => true, :html => { :class => "new_sport", :"data-type" => 'json', :id => '' } do |f| %>
    <%= f.label "Sport" %>
    <%= f.select :sport_id, Sport.all.collect { |sp| [sp.name, sp.id] }, {}, { class: "chosen", id: "" }  %>
    <br />
    <%= f.submit %>
  <% end %>
</div>

出于某种原因,<form>标签没有出现在 DOM 中,但所有其他字段都出现了..

4

1 回答 1

0

似乎 form_for 中的语法有一些问题。

尝试删除“id”并从中移动“数据类型”

<%= semantic_form_for @new_athlete_sport, :remote => true,
:html => { :class => "new_sport", :"data-type" => 'json', :id => '' } do |f| %>

对此

<%= semantic_form_for @new_athlete_sport, :remote => true, :data=> {:type=> 'json'}, :html => { :class => "new_sport"} do |f| %>
于 2013-05-08T02:33:35.587 回答