-
Notifications
You must be signed in to change notification settings - Fork 1
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
railtie: Add relation extension #41
Conversation
111b5b2
to
78d61ad
Compare
This commit adds two methods to `ActiveRecord::Relation`: - `Relation#create_readyset_cache!`, which creates a new cache based on the query represented by the relation; and - `Relation#drop_cache!`, which drops the cache associated with the query represented by the relation (if one exists)
78d61ad
to
193fe1b
Compare
Regarding the extension, I'm looking into how we can confirm that we're handling it safely, especially if we're aiming for good encapsulation of behaviors. Like we're assuming that users won't just make a web interface and allow users to pass in whatever they want to this module. I'll provide the actual feedback soon! |
@helpotters What kinds of safety concerns do you have? If you're worried about SQL injections, I think it'd be up to users to ensure that they are properly escaping their queries before |
In terms of whether we should be extending |
It's that and also the query builder (string concat vs adding to an array). I personally just don't know enough to be certain in either direction. So, I'm just going to look over some examples. |
Our approach to routing queries requires more granularity than is provided by the ActiveRecord middleware, so this commit removes the code that integrates with that middleware. NOTE: This PR is stacked on top of #41 and must be merged after that is merged
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.
Overall, this is good to go. The only requested changes are to the query builder (which could maybe be extracted to a method if we're going to use it anywhere else).
This is fantastic work, Ethan! Good test coverage.
Also, after reviewing this gem, I decided to finish up PR #32 (Logger). Methinks this PR could be made more robust for the developer by providing more feedback about what's going on. For example, within
Here are the specs for
|
@helpotters Ready for another pass -- thanks for the great comments! |
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.
After taking a second look at the spec, the query let
introduces Mystery Guests to the specs, mainly due to it being outside of the spec itself and also it being redefined later.
Everything else is solid, but I left some commentary on the topic of subject
that I don't think warrants the effort of a change due to the time crunch.
I've given some thought to my review process, and I think it has been both delayed and causing blocks in our progress. The feature itself is solid, I only had minor nitpicks about specs. While that does reflect on the overall codebase, given the dependencies of other PRs on this one, and the fact that the feature itself wouldn't be changed by the remaining feedback, it would be best to simply merge it. Granted, I think we should consider a better git workflow, mainly by working with a |
Our approach to routing queries requires more granularity than is provided by the ActiveRecord middleware, so this commit removes the code that integrates with that middleware. NOTE: This PR is stacked on top of #41 and should only be merged after that is merged
Our approach to routing queries requires more granularity than is provided by the ActiveRecord middleware, so this commit removes the code that integrates with that middleware. @helpotters I think this got lost somehow when #41 was merged, so reopening here!
This commit adds two methods to `ActiveRecord::Relation`: - `Relation#create_readyset_cache!`, which creates a new cache based on the query represented by the relation; and - `Relation#drop_cache!`, which drops the cache associated with the query represented by the relation (if one exists) --------- Co-authored-by: Paul Lemus <paullemus@protonmail.com>
Our approach to routing queries requires more granularity than is provided by the ActiveRecord middleware, so this commit removes the code that integrates with that middleware. @helpotters I think this got lost somehow when #41 was merged, so reopening here!
This commit adds two methods to
ActiveRecord::Relation
:Relation#create_readyset_cache!
, which creates a new cache based on the query represented by the relation; andRelation#drop_cache!
, which drops the cache associated with the query represented by the relation (if one exists)