bernat/best_in_place — Issue #53: Display_as always reverts textarea to original content
Author: svileng
Created: 2011-12-11 01:40:29+00:00
State: open

I would like to use best_in_place with a textarea type of field, and format the textarea to display new lines. I have the following code in my view:

```ruby
<%= best_in_place goal, :notes, :type => :textarea, :display_as => :display_notes %>
```

And the code for the display_notes method:

````ruby
def display_notes
h.simple_format model.notes
end
```

The text is displayed correctly, and updates correctly the first time, but when I click to edit it again, the textarea reverts back to the original text and does not display the new value. So you basically can't append text, and you also lose you previous changes, because as soon as you click away, best_in_place updates the model attribute again.

I have noticed that there is an html attribute called "data-original-content" which always stays the same, and doesn't updates when I edit the textarea, even the first time, when the change is successful. The "data-original-content" appears only when you use the :display_as option. If I don't use it, then everything works fine, but I obviously I will lose my textarea formatting.

Does anyone know a workaround for this problem?