编辑后,我使用best_in_place宝石做的Rails应用程序的一些行内编辑丢失。使用Rails的宝石“best_in_place”内置编辑 - 错误:新行上textarea的
我的一个对象的属性是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
),我仍然有同样的问题。
我发现.html_safe被扔一个错误,当该内容(V)为零,所以我测试对于它':display_with =>拉姆达{| V | v.nil? ? '':textilize(v).html_safe}' – 2014-08-27 06:01:44