-
Notifications
You must be signed in to change notification settings - Fork 54
Support scopes in multi_search #405
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #405 +/- ##
==========================================
+ Coverage 89.56% 89.62% +0.06%
==========================================
Files 13 13
Lines 776 781 +5
==========================================
+ Hits 695 700 +5
Misses 81 81 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@pozelli Please review and see if this makes multi_search behave how you expect it to 😄 @wesharper If you are interested in doing code review please take a look at this PR. (if you are not interested that's OK, it's not an assignment 😆 think of it more like a +cc) |
f7dcae3
to
d969d9b
Compare
Sure. This PR addresses these items from #397:
On the other hand:
I have tested the PR, and it works as I expected it to. |
README.md
Outdated
'books' => { q: 'Harry', class_name: 'Book' }, | ||
'mangas' => { q: 'Attack', class_name: 'Manga' } | ||
# Collection may be a relation | ||
'books' => { q: 'Harry', collection: Book.all }, |
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.
I just don't know about this name, I would vote for scope
or model
I'm not sure if collection is the term I hear the most when I'm talking/working about AR models.
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.
:scope
is something I considered, felt like it was at least as good as collection. I think that the name :scope
has the expectation that you could pass a symbol to it and it would call that (Rails) scope on the model. I would like to do that but it's not possible without already knowing the model specified in another param which would overcomplicate everything.
I don't think model
would be accurate since this is (in most cases) a Relation. I'll go ahead and rename to scope
.
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.
Just a remark about the name of the param but apart from that looks great!
d969d9b
to
1f1577a
Compare
Rebased to deal with conflicts, the review is stale now @brunoocasali |
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.
Looks great addition, thanks @ellnix for the awesome work as usual 👏
bors merge |
Pull Request
Related issue
Fixes part of #397
where
.