Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STI #2

Open
krisleech opened this issue Oct 14, 2009 · 1 comment
Open

STI #2

krisleech opened this issue Oct 14, 2009 · 1 comment

Comments

@krisleech
Copy link

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant