I have a quite average form in Rails, trough blog_kit
<% form_for(@blog_post, :html => { :multipart => true }) do |f| %>\
... other code
<%= f.text_area :body %>
<%= debug(@blog_post) %>
When editing a blog-post, the body suddenly contains additional spaces (marked as _ to visualise):
...sit amet eleifend diam imperdiet pharetra.
__
__## FOO?
__Morbi nec
Because a textarea is space-aware, it will show the spaces. On update, they are added to the database.
These spaces are not in the database (before the erronous update mentioned above, that is). Nor does the model BlogPost.find(1) contain these spaces.
script/console » b = BlogPost.find(1)
» puts b.body
...sit amet eleifend diam imperdiet pharetra.
## FOO?
Morbi nec
It appears some logic adds the spaces, after fetching the the database, but before rendering in the form partial. Candidates are:
- BlueCloth. I have that enabled, but cannot find a place where it would hook into the load process, and alter the body before it is rendered in the textarea
- HAML. The _form.html.rb partial is not (yet) migrated to _form.haml, so I assume haml stays away from this piece. But it might be part of the trouble?
I do not know where to start looking, so any hints would be very welcome.