-
-
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
Pass page local when rendering fields #1788
Conversation
Ah nice, thanks! It's fairly likely that me merging that caused this. To stop this happening again, can you think of a way we can test this? Ideally the ideal solution to the problem. |
Totally! I think the reproduction ended up being trying to render I'm used to using |
Issue also reported at #1792 |
@bobcats - I agree that testing for the page not to error is not ideal. I wonder if this could be done with a view spec instead? Eg: trying to render something at https://github.com/thoughtbot/administrate/blob/master/spec/administrate/views/fields/has_one/_show_spec.rb and checking that the expected text is there. |
Thanks for the feedback folks! I've tried testing the scenario as a view spec, with albeit a lot of double-ifying. Let me know what you all think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this. It looks pretty good. Regarding those stubs, I think let's try use the real objects (left some comments on that). I see that the original file was already using many stubs and you followed the same pattern, but I'd rather start do differently here.
@pablobm Thanks for the feedback again! So, I tried using real objects, but end up getting being unable to reproduce the original error because the combinations of associations that show this issue don't seem to exist in the sample app's models. Should I create that particular combination of associations in the sample app and then use the real models to do so? I was trying to avoid changing the models, but since there's a fair amount of reflecting going on, it seems more straightforward. I think I need a Parent |
@bobcats - It's ok, thanks for trying. I think we can merge this as-is then. No need to make it more complicated than it needs be. |
Hi there!
We live dangerously and run on edge for administrate, and seems like a recent change (#1259) has caused
HasOne
's to not render in our app with aundefined local variable or method 'page'
The proposed change in the PR seems to resolve the error.
Let me know if I need to change anything, or if this is too naive of a solution.
Thanks!