Sha256: e174fdb8d3dc9f53cc8d83cfaa58628fd397c4eb4664c756e332f9137f477bc7

Contents?: true

Size: 344 Bytes

Versions: 91

Compression:

Stored size: 344 Bytes

Contents

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

91 entries across 86 versions & 8 rubygems

Version Path
mongoid-7.0.13 spec/app/models/birthday.rb
mongoid-7.0.12 spec/app/models/birthday.rb
mongoid-6.4.8 spec/app/models/birthday.rb
mongoid-7.0.11 spec/app/models/birthday.rb
mongoid-7.0.10 spec/app/models/birthday.rb
mongoid-6.4.7 spec/app/models/birthday.rb
mongoid-6.4.5 spec/app/models/birthday.rb
mongoid-7.0.8 spec/app/models/birthday.rb
mongoid-7.0.7 spec/app/models/birthday.rb
mongoid-7.0.6 spec/app/models/birthday.rb
mongoid-5.4.1 spec/app/models/birthday.rb
mongoid-7.0.5 spec/app/models/birthday.rb
mongoid-7.0.4 spec/app/models/birthday.rb
mongoid-6.4.4 spec/app/models/birthday.rb
mongoid-7.0.3 spec/app/models/birthday.rb
mongoid-6.4.2 spec/app/models/birthday.rb
mongoid-7.0.2 spec/app/models/birthday.rb
mongoid-7.0.1 spec/app/models/birthday.rb
mongoid-6.4.1 spec/app/models/birthday.rb
mongoid-5.4.0 spec/app/models/birthday.rb