我有这个表格 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]' %>
我该怎么做?
谢谢!
最佳答案
简单表单根据模型字段的类型自动确定正确的标记。您还可以指定字段的类型(如form_for
):f.text_field :tags
- 简单表单支持此语法。
关于ruby-on-rails - simple_form gem 中的 text_field_tag,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10358030/