Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement