Make sure @resource is also set for nested fields#83
Open
pedantic-git wants to merge 1 commit into
Open
Conversation
Owner
nickcharlton
left a comment
There was a problem hiding this comment.
Ah, nice! Is there a way we could reasonably test, mostly so we don't introduce a regression at some point?
Author
|
I couldn't see an easy win there, unfortunately, and I couldn't get the tests to run locally because of their dependency on Postgres. If you can think of a way to test it I'll happily add! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey @nickcharlton - long time since we've interacted on Administrate-related things!
I love this gem and it's been really useful in my latest project. One bug I found is that if any of the fields from the associated dashboard use
self.resource, they end up picking up the parent resource instead of the nested one.You'd already used
instance_variable_setto set theself.dataand so I propose that the gem uses the same methodology to setresource.I've tested this fix in my app that has a full test suite and it hasn't broken any of the tests in that app. I couldn't get the gem's tests to run because they depend on a postgres database, which I don't have, but I couldn't see a place in the tests for defending this change anyway - the earlier
@datasetting doesn't appear to have a test defending it.Let me know what you think!