我在新视图和编辑视图中呈现了一个表单:
<%= simple_form_for(@course, html: {class: "form-horizontal"}) do |f| %>
由于我的编辑表单应该略有不同:simple_form_for([@category, @course]),是否有一种基于控制器操作(编辑或新的)编写条件的方法?
# if controller action is new
<%= simple_form_for(@course, html: {class: "form-horizontal"}) do |f|
如何呈现通过表单提交的HTML?
我正在一个Rails 4应用程序中构建一个文本编辑器。我使用javascript将内容可编辑的数据传递到要保存到数据库的表单中。目前为止一切都很好。
除了用户保存的文本外,还包括HTML .所以我保存的内容如下所示:
<header class="header" contenteditable="true">
This is a title
</header>
<article class="content" contenteditable="t