【发布时间】:2014-06-23 13:51:52
【问题描述】:
我正在使用 Rails 4、Bootstrap 3 和 Simple_form,由于某种原因,“提交”按钮没有提交任何内容。它甚至没有在服务器输出中生成任何东西供我调试。
这是我的代码:
<%= simple_form_for(@schedule) do |f| %>
<% if @schedule.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@schedule.errors.count, "error") %> prohibited this schedule from being saved:</h2>
<ul>
<% @schedule.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<form class="form-inline" role="form">
<div class="form-group">
<%= f.input :rating, collection: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] %>
</br>
<%= f.input :thought, :input_html => {:rows => 10, :cols => 85} %>
</div>
</form>
<div class="actions">
<%= f.button :submit, "Create", :class => 'btn btn-primary'%>
</div>
<% end %>
这是我的模型:
class Schedule < ActiveRecord::Base
validates :rating, :presence => true
validates :thought, :presence => true
end
我确信这很简单,但我完全被难住了。
提前致谢。
【问题讨论】:
-
可以在 HTML 中的表单中包含表单吗?
标签: ruby-on-rails ruby twitter-bootstrap simple-form