【发布时间】:2012-03-26 01:38:28
【问题描述】:
我正在使用best_in_place gem 在 Rails 应用程序中进行一些内联编辑。
我的对象的属性之一是 text 类型,我希望它在文本区域中进行编辑,所以我这样做了:
<%= best_in_place @myobject, :description, :type => :textarea %>
它可以工作,但是当不被编辑时,所有返回 (\n) 都会被删除。
我尝试使用 simple_format,将 :display_with => :simple_format 添加到传递给 best_in_place 的选项中:
<%= best_in_place @myobject, :description, :type => :textarea, :display_with => :simple_format %>
未编辑时,新行将按预期显示。但是点击进入版本被破坏了,并且在上面添加了一个新的破折号。单击它会显示一个 textarea 框,但它是空的,并且在那里输入的文本不会保存回我的对象。
我的属性中保存的内容只是纯文本,不包含任何html。
这个问题(和补丁)似乎与我的问题有关:https://github.com/bernat/best_in_place/pull/111
但是,当应用补丁(手动,到文件.../gems/best_in_place-1.0.6/spec/spec_helper.rb)时,我仍然遇到同样的问题。
【问题讨论】:
标签: ruby-on-rails best-in-place