Last active
August 29, 2015 14:19
-
-
Save belguzmani/4a9d4b2038042cd2afc6 to your computer and use it in GitHub Desktop.
Daily Events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
include Mongoid::Document | |
field :email, type: String | |
field :month, type: Date | |
field :monthly_total, type: Hash, default: {:email_open => 0, :email_click => 0, :page_view => 0} | |
has_many :monthly_events | |
end | |
class MonthlyEvent | |
include Mongoid::Document | |
field :name, type: String | |
belongs_to :person | |
embeds_many :daily_events # this would only contain until 31 documents | |
end | |
class DailyEvents | |
include Mongoid::Document | |
field :day | |
field :email_open, type: Integer | |
field :email_click, type: Integer | |
field :page_view, type: Integer | |
embedded_in :monthly_event | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment