Sha256: 4220dfa59dd0064cf7a5e679c1ca5a9b3b3a35c3d85fc0f93d80d05ba96ac5ed

Contents?: true

Size: 375 Bytes

Versions: 29

Compression:

Stored size: 375 Bytes

Contents

# frozen_string_literal: true

class Birthday
  include Mongoid::Document
  field :title
  field :date, type: Date
  embedded_in :owner, inverse_of: :birthdays

  def self.each_day(start_date, end_date)
    groups = only(:date).asc(:date).where(:date.gte => start_date, :date.lte => end_date).group
    groups.each do |date, group|
      yield(date, group)
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
mongoid-8.0.10 spec/support/models/birthday.rb
mongoid-8.1.10 spec/support/models/birthday.rb
mongoid-8.1.9 spec/support/models/birthday.rb
mongoid-8.0.9 spec/support/models/birthday.rb
mongoid-8.1.8 spec/support/models/birthday.rb
mongoid-8.1.7 spec/support/models/birthday.rb
mongoid-8.1.6 spec/support/models/birthday.rb
mongoid-8.0.8 spec/support/models/birthday.rb
mongoid-8.1.5 spec/support/models/birthday.rb
mongoid-8.1.4 spec/support/models/birthday.rb
mongoid-8.0.7 spec/support/models/birthday.rb
mongoid-8.1.3 spec/support/models/birthday.rb
mongoid-8.1.2 spec/support/models/birthday.rb
mongoid-8.0.6 spec/support/models/birthday.rb
mongoid-7.5.4 spec/support/models/birthday.rb
mongoid-8.1.1 spec/support/models/birthday.rb
mongoid-8.0.5 spec/support/models/birthday.rb
mongoid-8.1.0 spec/support/models/birthday.rb
mongoid-7.5.3 spec/support/models/birthday.rb
mongoid-8.0.4 spec/support/models/birthday.rb