可以在没有模型的情况下使用Simple Form (by: Plataformatec)吗?
发布于 2011-03-03 21:56:12
您可以使用:symbol作为第一个参数。
<%= simple_form_for :user, url: users_path do |f| %>
<%= f.input :name, as: :string %>
...
<% end %>它将输出类似如下的内容:
<form novalidate="novalidate" class="simple_form user" action="/users" accept-charset="UTF-8" method="post">
...
<div class="input string required user_name">
<label class="string required" for="user_name">
<abbr title="required">*</abbr> Name
</label>
<input class="string required" type="text" name="user[name]" id="user_name" />
</div>
...
</form>https://stackoverflow.com/questions/5181143
复制相似问题