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

Add AlbumPolicy::Scope & use in ArtistsController#show #135

Merged

Conversation

floehopper
Copy link
Member

I think this is more idiomatic use of Pundit and it simplifies ArtistsController#show nicely which will make adding an Atom feed for that action easier.

I suspect there's a nicer way to implement the 2nd expression in the if statement in AlbumPolicy::Scope#resolve, but the one I've gone with seems to result in a sensible number of queries.

@floehopper
Copy link
Member Author

@chrislo What do you think? Hopefully I haven't messed up the logic this time! 😬

I think this is more idiomatic use of Pundit and it simplifies
`ArtistsController#show` nicely which will make adding an Atom feed for
that action easier.

I suspect there's a nicer way to implement the 2nd expression in the
`if` statement in `AlbumPolicy::Scope#resolve`, but the one I've gone
with seems to result in a sensible number of queries.
@floehopper floehopper force-pushed the add-album-policy-scope-and-use-in-artists-controller-show branch from af19a6a to dff58b9 Compare January 9, 2024 09:32
Copy link
Member

@chrislo chrislo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me!

@floehopper
Copy link
Member Author

This makes sense to me!

Thanks, Chris!

@floehopper floehopper merged commit 030daa8 into main Jan 9, 2024
2 checks passed
@floehopper floehopper deleted the add-album-policy-scope-and-use-in-artists-controller-show branch January 9, 2024 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants