easy-fckeditor icon indicating copy to clipboard operation
easy-fckeditor copied to clipboard

STI

Open krisleech opened this issue 15 years ago • 1 comments

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.

krisleech avatar Oct 14 '09 11:10 krisleech

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.

krisleech avatar Oct 14 '09 12:10 krisleech