Sha256: 5e5975a9c36bfc2e15d46c3c3187dcd429747e807cdad42128420f95da83582b

Contents?: true

Size: 477 Bytes

Versions: 11

Compression:

Stored size: 477 Bytes

Contents

class Event
  include Mongoid::Document

  field :title
  field :date, :type => Date
  has_and_belongs_to_many \
    :administrators,
    :class_name => 'Person',
    :inverse_of => :administrated_events,
    :dependent => :nullify
  belongs_to :owner

  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 |hash|
      yield(hash["date"], hash["group"])
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mongoid_geospatial-2.8.2 spec/models/event.rb
mongoid_geospatial-2.8.1 spec/models/event.rb
mongoid_geospatial-2.8.0 spec/models/event.rb
mongoid_geospatial-2.7.2 spec/models/event.rb
mongoid_geospatial-2.7.1 spec/models/event.rb
mongoid_geospatial-2.7.0 spec/models/event.rb
mongoid_geospatial-2.5.1 spec/models/event.rb
mongoid_geospatial-2.5.0 spec/models/event.rb
mongoid_geospatial-2.3.0 spec/models/event.rb
mongoid_geospatial-2.2.0 spec/models/event.rb
mongoid_geospatial-2.0.0 spec/models/event.rb