-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Nested polymorphic #1338
Comments
There is no support for nested polymorphics at the moment. I am not sure what it would involve. I'll investigate. |
Much thanks! |
+1 This was working as of v0.0.5 and is a must-have feature for us. I was sad to see this error on upgrading my installed version. |
I've looked at this a little, and it seems like there's been a slight regression that's causing this error for me. When nesting an associated model, :inverse_of is meant to hide the field that represents the current association (that the nested model will be saved into). That seems to not be the case for the polymorphic association that I'm testing with - when I exclude that field in the Hope that helps in tracking down the issue! |
@michaek is correct. This fixed my issue. config.model Document do
include_all_fields
nested do
field :documentable do
visible false
end
end
end |
This setup worked for me.
|
What I see is that in nested_field_association method in file form_builder.rb
This only happens if I add inverse_of to the children model. Using @chrisbloom7 example, it is the Note model. Using 0.6.5 |
field.associated_model_config returns an array, but abstract_model is in field
Actually, if you use my fork
In the time being, you can add inverse_of to both sides and it will work like a charm :) |
@pencilcheck, thank you for your fork, it's working fine for me. I strongly recommend the merge. |
This fork is working fine for me as well. I'm not sure what the merge would entail but it would be worth investigating. |
Hello, what is the status of this. Will this patch be merged, or we already have a better implementation? |
+1 |
@bbenezech - @pencilcheck's fix worked for me as well. Do we expect this to be merged / supported soon? |
Don't try to access abstract_model of Array.
Hi guys, I created a pull request for that change but it seems like we need rspec tests for it. Anyone feels like tackling this? Unfortunately I'm not too familiar with that level of testing... and I would definitively learn from it! |
Merged! |
I'm attempting to have a nested polymorphic has_many with:
I would like to have a nested form within each page or offering, but I'm getting
The text was updated successfully, but these errors were encountered: