Recurring date time fields for Mongoid models, using IceCube.
When included in a model, this gem expands the recurring rules set of an
IceCube schedule on save into an array of embedded
It also adds definitions of several scopes that allow for convenient querying of models stored in the db.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install mongoid_recurring
class MyModel include Mongoid::Document include :: has_recurring_fields end
Which will then add
schedule_dtend fields to the model.
The model will generate all occurrences on before save, and store them as
MongoidRecurring::Occurrence documents in the
:occurrences embedded relation.
A scope named
.for_datetime_range can be then used to query for documents with occurrences in specified DateTime range:
MyModel.for_datetime_range( Date.today, Date.today+1.week )
By default, when
schedule_dtend is not specified, the
occurrences are populated for 1 year in advance. This duration can be configured as follows:
has_recurring_fields schedule_duration: 2.weeks
- MongoidIceCubeExtension for storing
IceCubeschedule in Mongoid documents
- SimpleFormRecurringSelect for adding
After checking out the repo, run
bin/setup to install dependencies. Then, run
bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run
bundle exec rake install. To release a new version, update the version number in
version.rb, and then run
bundle exec rake release to create a git tag for the version, push git commits and tags, and push the
.gem file to rubygems.org.
- Fork it ( https://github.com/tomasc/mongoid_recurring/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request