Low commit activity in last 3 years
A long-lived project that still receives updates
When the object or arg to a delayed_job is a Mongoid document, store only a small stub of the object instead of the full serialization.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

delayed_job_shallow_mongoid

Tests Rubocop Coverage Status Gem Version

This library short-circuits serialization of Mongoid model instances when a delayed job is called on them, or when they're passed as arguments to a delayed job. Rather than generate and store the fully-serialized YAML, a simple stub is stored. When the job is run, the stub is recognized and a find is done to look up the underlying document. If a referenced model isn't found at this point, the job simply does nothing.

Requires Ruby 2.7 or newer. CI exercises Mongoid 6-9, Rails 5.2/6.1/7.2/8.0/8.1, and Ruby 2.7/3.3/3.4/4.0 in compatible combinations. Mongoid 6 and 7 are tested with MongoDB 4.4; Mongoid 8 and 9 use MongoDB 8.0. Legacy combinations are compatibility checks, not recommendations for new applications.

Development

The default bundle uses Mongoid 9 and Rails 8.1. Use Ruby 3.3 or newer and start MongoDB before running the suite:

bundle install
bundle exec rake

Tests use mongodb://127.0.0.1:27017/delayed_job_shallow_mongoid_test by default. Override MONGODB_URI to use an isolated test database. The suite purges and drops this database; never point it at development or production data.

To select another compatible dependency combination:

MONGOID_VERSION='~> 8.1' RAILS_VERSION='~> 7.2' bundle update
MONGOID_VERSION='~> 8.1' RAILS_VERSION='~> 7.2' bundle exec rake

Every test run writes HTML coverage to coverage/index.html and LCOV coverage to coverage/lcov.info, enforcing at least 90% line and 80% branch coverage. GitHub Actions uploads coverage artifacts and reports the compatibility jobs to Coveralls.

Contributions

  • Contributions encouraged. Feature branches appreciated.
  • Add user-facing changes to the next release in CHANGELOG.md, linking the issue or pull request and crediting the contributor. Danger checks new and edited entries without reformatting historical releases, and reminds contributors to update the changelog; README-only changes are exempt. Changelog review runs separately on Ruby 3.4 and publishes a report on pull requests, including forks, using GitHub's built-in token; no personal access token or shared Mongoid Danger gem is required.
  • Development generously supported by Artsy.

Maintainers: see RELEASING.md for release preparation, publishing, and verification.

Copyright

Copyright (c) 2011-2015 Joey Aghion, Artsy Inc.

MIT License. See LICENSE for further details.