Sha256: fe476877023fe0f1c491ef9e9a965bdf59964fb682c6d5f8f917ceae62d21a00

Contents?: true

Size: 490 Bytes

Versions: 22

Compression:

Stored size: 490 Bytes

Contents

class Event
  include Mongoid::Document

  field :title
  field :date, :type => Date
  references_and_referenced_in_many \
    :administrators,
    :class_name => 'Person',
    :inverse_of => :administrated_events,
    :dependent => :nullify
  referenced_in :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

22 entries across 22 versions & 4 rubygems

Version Path
mongoid_spacial-0.2.17 spec/models/event.rb
sig_mongoid_spacial-0.2.17 spec/models/event.rb
cb_mongoid_spacial-0.2.16 spec/models/event.rb
mongoid_geospatial-1.0.0 spec/models/event.rb
mongoid_geospatial-1.0.0rc1 spec/models/event.rb
mongoid_geospatial-1.0.0rc0 spec/models/event.rb
mongoid_spacial-0.2.16 spec/models/event.rb
mongoid_spacial-0.2.13 spec/models/event.rb
mongoid_spacial-0.2.12 spec/models/event.rb
mongoid_spacial-0.2.11 spec/models/event.rb
mongoid_spacial-0.2.10 spec/models/event.rb
mongoid_spacial-0.2.8 spec/models/event.rb
mongoid_spacial-0.2.7 spec/models/event.rb
mongoid_spacial-0.2.6 spec/models/event.rb
mongoid_spacial-0.2.5 spec/models/event.rb
mongoid_spacial-0.2.4 spec/models/event.rb
mongoid_spacial-0.2.3 spec/models/event.rb
mongoid_spacial-0.2.2 spec/models/event.rb
mongoid_spacial-0.2.0 spec/models/event.rb
mongoid_spacial-0.1.1 spec/models/event.rb