-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Use new_resource in new action #1097
Conversation
Thanks for this! It sounds like we should make sure it still works with a Do you also think you'd be able to add some tests for the feature this gives us, too? |
hi @nickcharlton, sorry for delay
To supported creation of has_many via nested forms, I believe, we need to change https://github.com/nickcharlton/administrate-field-nested_has_many As for tests, I'm not sure what I can test exactly, as, basically that's a one line refactoring so far. It's supposed to being overriden and then it gives new functionality |
Okay, cool! Could you try and confirm if we do indeed to change |
On one hand, this PR looks like a slam dunk to me (provided there's a rebase first). I can't see how it would interfere with anything, and I can see how it's beneficial to have this API. On the other hand, I'm looking into @nickcharlton, do you have any thoughts? |
- Remove code duplication - Simplify making new form with prefilled associations
I rebased and then merged. We'll worry about nested has many when it's a problem (assuming it is!). |
Is this |
I don't believe so, but I might be wrong. Would you be able to do that? If it doesn't fit anywhere as is, we might want to create an "Administrate Internals" documentation page. |
Sorry @nickcharlton I'm not familiar with this method, maybe someone else knows a bit more? |
I don't either! I'll open a new issue to keep track of it. |
new_resource
method instead of new action to init resource associationsP.S. Though, it works as expected on has_one association, when trying to build has_many association it doesn't work. The reason is that select is used on has_many form and only ids get send with the request. And because the record doesn't have an id it gets lost. I'm not sure if it's a bug and should be addressed or not, please let me know what you think.