-
Notifications
You must be signed in to change notification settings - Fork 49
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
undefined method persisted?' (and
to_key) for #<Hash> when using Composition and
form_for`
#63
Comments
Also ran into this error:
Workaround was:
|
persisted?' (and
to_key) for #<Hash> when using Composition and
form_for`
I tried including When I tried stepping into
So it looks like it's supposed to delegate to the main model. But I also found this occurrence of
and I'm guessing that overrides the previous delegation and is what breaks things (for those of us using How can we get it working how it's supposed to (delegate those methods to main model)? |
Well, it looks like you can work around it by copying and pasting code!
|
@TylerRick are you using Usually
look the source that's exactly what you are doing 😉 |
more info on the docs |
Yes, I'm using It needs to delegate the messages to |
ohhhh yeah @TylerRick , now I see what you are facing How would you make with "plain" Rails? Create a model the inherits |
Without
Composition
,persisted?
works fine, but withComposition
it gives this error apparently because it delegates to itsmodel
which is a Hash of multiple models.Steps to reproduce
Using it in a form with
form_for @form
also generates the error, sinceform_for
callspersisted?
.Workaround
An easy workaround is to simply add this to form class:
The text was updated successfully, but these errors were encountered: