All Projects → ElMassimo → mongoid_includes

ElMassimo / mongoid_includes

Licence: MIT License
🌿 Improves eager loading support for Mongoid

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to mongoid includes

Mongoid Rspec
RSpec matchers and macros for Mongoid.
Stars: ✭ 494 (+1048.84%)
Mutual labels:  mongoid
Enumerize
Enumerated attributes with I18n and ActiveRecord/Mongoid support
Stars: ✭ 1,637 (+3706.98%)
Mutual labels:  mongoid
GB-html5-respond
移动端响应式布局解决方案(JavaScript + REM)
Stars: ✭ 34 (-20.93%)
Mutual labels:  queries
Lockbox
Modern encryption for Ruby and Rails
Stars: ✭ 905 (+2004.65%)
Mutual labels:  mongoid
Graphql devise
GraphQL interface on top devise_token_auth
Stars: ✭ 100 (+132.56%)
Mutual labels:  mongoid
Groupify
Add group and membership functionality to your Rails models
Stars: ✭ 187 (+334.88%)
Mutual labels:  mongoid
Algoliasearch Rails
AlgoliaSearch integration to your favorite ORM
Stars: ✭ 352 (+718.6%)
Mutual labels:  mongoid
pimpable
No description or website provided.
Stars: ✭ 102 (+137.21%)
Mutual labels:  eager-loading
Simple token authentication
Simple (but safe) token authentication for Rails apps or API with Devise.
Stars: ✭ 1,474 (+3327.91%)
Mutual labels:  mongoid
Queries
SQLite queries
Stars: ✭ 57 (+32.56%)
Mutual labels:  queries
Fabrication
This project has moved to GitLab! Please check there for the latest updates.
Stars: ✭ 1,017 (+2265.12%)
Mutual labels:  mongoid
Mongoid auto increment id
Override id field to MySQL like auto increment for Mongoid.
Stars: ✭ 68 (+58.14%)
Mutual labels:  mongoid
query2metric
A tool to run queries in defined frequency and expose the count as prometheus metrics. Supports MongoDB and SQL
Stars: ✭ 21 (-51.16%)
Mutual labels:  queries
Datagrid
Gem to create tables grids with sortable columns and filters
Stars: ✭ 921 (+2041.86%)
Mutual labels:  mongoid
miniql
A tiny JSON-based query language inspired by GraphQL
Stars: ✭ 121 (+181.4%)
Mutual labels:  queries
Aasm
AASM - State machines for Ruby classes (plain Ruby, ActiveRecord, Mongoid, NoBrainer, Dynamoid)
Stars: ✭ 4,474 (+10304.65%)
Mutual labels:  mongoid
Delayed job mongoid
Mongoid backend for delayed_job
Stars: ✭ 173 (+302.33%)
Mutual labels:  mongoid
rocketjob
Ruby's missing background and batch processing system
Stars: ✭ 281 (+553.49%)
Mutual labels:  mongoid
WP-Query-Console
⚡ Handy WordPress plugin to test various WordPress queries -
Stars: ✭ 25 (-41.86%)
Mutual labels:  queries
mongoid taggable on
Taggable on custom fields for Mongoid
Stars: ✭ 16 (-62.79%)
Mutual labels:  mongoid

Mongoid::Includes

Gem Version Build Status Test Coverage Code Climate Inline docs License

Mongoid::Includes improves eager loading in Mongoid, supporting polymorphic associations, and nested eager loading.

Usage

Album.includes(:songs).includes(:musicians, from: :band)

Band.includes(:albums, with: ->(albums) { albums.gt(release: 1970) })

# The library supports nested eager loading using :from for terseness,
# but you can manually include nested associations using the :with option.
released_only = ->(albums) { albums.where(released: true) }
Musician.includes(:band, with: ->(bands) { bands.limit(2).includes(:albums, with: released_only) })

Pro Tip

Since you can modify the queries for the associations, you can use only and make your queries even faster:

Band.includes :musicians, with: ->(musicians) { musicians.only(:id, :name) }

Advantages

  • Avoid N+1 queries and get better performance.
  • No boilerplate code is required.
  • Modify the queries for related documents at will.

Installation

Add this line to your application's Gemfile and run bundle install:

  gem 'mongoid_includes'

Or install it yourself running:

gem install mongoid_includes

License

Copyright (c) 2015 Máximo Mussini

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].