Modifying the querying strategy on a per-query basis #668
Closed
ghiculescu
started this conversation in
Ideas
Replies: 2 comments
-
I don't have much to add since I agree with you 100%. I think I'd normally use option 1, because is less code to write but I'd love to have also option 2 available and, as you said, option 2 could anyway be the internal implementation of option 1. Really nothing to add from my side. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In #655 I added
CanCan.accessible_by_strategy
, which allows you to toggle between different waysaccessible_by
builds queries that contain joins.@coorasse and @madmax were keen for a way to customise this on a per-query basis. I was hesitant to do that, because it felt like it would add a lot of complexity to the PR and what I had was good enough for my use case. That said, I think it is worth discussing for others, so I'd like to settle on an API first.
Option 1: new arg
Option 2: yielding a scope
Thinking this through, I suspect the easiest way to implement option 1 would be to build option 2 and then use it internally. I'm happy to do that, but before I do, would like feedback on either / both of these APIs, as well as thoughts on if there's any better approaches out there.
Beta Was this translation helpful? Give feedback.
All reactions