Skip to content
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

fix: via resource class returns model classes vs resource classes #1293

Merged
merged 11 commits into from Oct 10, 2022

Conversation

adrianthedev
Copy link
Collaborator

@adrianthedev adrianthedev commented Oct 7, 2022

Description

Fixes an issue where if you had multiple resources representing a model, in some areas of your app, the first resource in an alphabetical order would get assigned instead of the proper one.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Manual review steps

  1. Enable z_posts (named like this to ensure it will be the last alphabetically) resource in the sidebar
  2. Navigate to one post
  3. go and navigate to a PhotoComment (below).
  4. observe that the breadcrumbs point to z_posts (not posts)

Manual reviewer: please leave a comment with output from the test if that's the case.

@github-actions github-actions bot added the Fix label Oct 7, 2022
@codeclimate
Copy link

codeclimate bot commented Oct 7, 2022

Code Climate has analyzed commit 865579a and detected 0 issues on this pull request.

View more on Code Climate.

@adrianthedev adrianthedev marked this pull request as ready for review October 7, 2022 10:40
@adrianthedev
Copy link
Collaborator Author

Hey @bear-in-mind. This was easier than expected. Can you give it a try and see if this fixes your particular issue? This will definitely fix more issues from the past and down the line.

@bear-in-mind
Copy link
Contributor

Thank you so much Adrian ! Will give it a go early afternoon :)

@adrianthedev
Copy link
Collaborator Author

Awesome! You might need to run rails avo:build-assets if you use it off GitHub.

@bear-in-mind
Copy link
Contributor

bear-in-mind commented Oct 7, 2022

So indeed, a few issues seem to be solved by your changes, including the one I showed you with the breadcrumbs 😎

However the Back button in nested resources is still referring to the wrong parent resource. Here's a screenshot (sorry, it's in French...):

Screenshot 2022-10-07 at 17 55 00

@adrianthedev
Copy link
Collaborator Author

🙌 Fixed that as well. The global association_resource finds the proper resource now.

@bear-in-mind
Copy link
Contributor

Works greaaaaat 🙏🙏🙏
Thank you so much Adrian !

@adrianthedev adrianthedev merged commit b45530c into main Oct 10, 2022
@adrianthedev adrianthedev deleted the fix/via-resource-class-to-output-resource-classes branch October 10, 2022 12:52
@github-actions
Copy link
Contributor

This PR has been merged into main. The functionality will be available in the next release.

Please check the release guide for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants