easy-fckeditor
easy-fckeditor copied to clipboard
STI
Problem - Two copies of input values in params, neither of which contain the body attribute (the one given to the helper) when editting a STI instance.
class Document < AR end
class Page < Document end
When creating a new Document everything works as expected, I pass the 'type' in a hidden field.
<%= fckeditor_textarea("document", "body", :toolbarSet => 'Simple', :width => '100%', :height => '200px') %>
However when I try and edit a Page (same _form, but now its an instance of Page because the type field has been set) I get params[:document]
and params[:page]
, but neither hash contain the a [:body]
key.
I see no evidence in the source or generated source of any additional inputs being added to the DOM. I see nothing in the helper method that could cause this.
It seems the duplicated params
was Rails related adding: <% form_for @document.becomes(Document)
prevented this. As a result I also got the [:body] key back in the hash. All in all not sure why this works but it does.