delayed_job_shallow_mongoid
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 rakeTests 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 rakeEvery 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.