-
Notifications
You must be signed in to change notification settings - Fork 335
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
Bug in accessing object in child block #393
Comments
+1 we're seeing this in the latest version |
👍 +100. Is no one else getting this error? Seems pretty big to me. |
+1 |
Can anyone take a look at the "why" this is happening? It does seem like a pretty big regression if this is happening. Can someone play around with older versions and identify when this regression happened? Maybe @DouweM might be able to take a look eventually too. Thanks. |
I'm almost sure this has always been the behavior; the documentation has just been incorrect. In the commit where this feature was introduced, a895fcc, you can see it's passing |
I see, thanks for investigating that. Looks like the docs are at fault leading to the confusion and the years since I implemented that have made the details of how that worked hazy. |
Can you or anyone implement this? I think many users are waiting for this feature.. Would be great :-) |
Note that the original pull request (#300) explicitly calls for the current behavior, not the documented behavior, and it seems unwise to introduce such a backward-incompatible change seeing as it's worked this way for 3 years. We could add a second argument to be passed to the block which would be the root object "one level up" rather than the root object to the child call:
|
I agree that changing the current behavior would lead to confusion. Adding a second argument to access the correct object in my collection would solve my problem. |
+1 |
anyone know a work around for this so you can access the parent? |
According to the docs it's possible to pass the current object to a child block like so:
What I'm seeing is that the block argument is not the "user" but rather the "posts" ActiveRecord relation. I'm not sure if this a bug in the docs or one in the implementation. If the former, how does one access the user object when processing its posts?
The text was updated successfully, but these errors were encountered: