
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
graphql-eager_loader
Advanced tools
Eager-load your Active Record associations automagically.
Call this method like this:
Graphql::EagerLoader::LookaheadLoader.call(Project, lookahead)
Here's a full example with 'graphql' field:
field :projects, Types::ProjectType, null: true, extras: [:lookahead]
def projects(lookahead:)
Graphql::EagerLoader::LookaheadLoader.call(Project, lookahead).all # or: .where(published: true)
end
This method allows you to add additional functionality while eager loading app's models.
For example you can do stuff like (notice the location of .all
below):
field :projects, Types::ProjectType, null: true, extras: [:lookahead]
def projects(lookahead:)
Graphql::EagerLoader::LookaheadLoader.call(Project, lookahead) do |eager_loaded_model, associations|
associations.values.each do |association|
if association.instance_of?(ActiveRecord::Reflection::HasManyReflection)
eager_loaded_model = eager_loaded_model.merge(association.klass.where(published: true))
end
end
eager_loaded_model
end.all
end
gem 'graphql-eager_loader'
And then execute:
$ bundle install
Contributions welcome!
Thank you to @colinjfw for the great GraphQL-Api gem that inspired this.
Thank you to @rmosolgo for the incredible GraphQL gem.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that graphql-eager_loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.