带有form_with的标签上没有“ for”

时间:2018-09-28 14:36:34

标签: ruby-on-rails forms

我有一个非常基本的形式:

( SELECT table_owner || '.' || table_name AS table_name
  FROM all_tab_modifications
  WHERE timestamp >= SYSDATE - 80 AND table_owner IN (
       'AXIOM_DATA',
       'AXIOM_DATA2',
       'AXIOM_META',
       'AXIOM_META2'
  ) AND table_name LIKE 'RPTD_%'
)
MINUS
( SELECT owner || '.' || object_name AS table_name
  FROM dba_objects
  WHERE created >= SYSDATE - 80 AND owner IN (
       'AXIOM_DATA',
       'AXIOM_DATA2',
       'AXIOM_META',
       'AXIOM_META2'
  ) AND object_name LIKE 'RPTD_%' AND object_type = 'TABLE'
);

当我查看生成的HTML时,我真的很惊讶,因为标签上没有属性“ for”。因此,当我单击复选框标签时,该复选框将不会在我的浏览器中签入:

<%= form_with model: @program, url: program_path, method: :put do |f| %>
  <%= f.check_box :new_model %>
  <%= f.label :new_model, 'my label'%>
<% end %>

当我使用<form action="/programs/17" accept-charset="UTF-8" method="post"> [ ... ] <input value="1" name="program[new_model]" type="checkbox"> <label>my label</label> </form> 代替form_for时,一切都很好。

我应该如何使Rails在标签上生成form_with属性?

0 个答案:

没有答案