2

私はsimple_form gemでこのフォームを持っています

<%= simple_form_for(@post) do |f| %>
  <%= f.error_notification %>

  <div class="form-inputs">
    <%= f.input :title %>
    <%= f.input :description, :as => :text %>
    <%= text_field_tag 'post[tags]' %>
  </div>

  <div class="form-actions">
    <%= f.button :submit %>
  </div>
<% end %>

この行に simple_form 形式で書きたい:

<%= text_field_tag 'post[tags]' %>

どうすればいいですか?

ありがとうございました!

4

1 に答える 1

2

単純なフォームは、モデル フィールドのタイプに応じて、正しいタグを自動的に決定します。フィールドのタイプを指定することもできます (のようにform_for): f.text_field :tags- 単純なフォームはこの構文をサポートします。

于 2012-04-28T10:12:55.667 に答える