orbit-basic/app/models/journal.rb

20 lines
305 B
Ruby
Raw Normal View History

class Journal
include Mongoid::Document
include Mongoid::Timestamps
field :user_id
field :title
belongs_to :user
has_many :papers, :autosave => true, :dependent => :destroy
before_create :initialize_paper
def initialize_paper
2012-06-26 13:09:33 +00:00
for i in 0..5
self.papers.build
end
end
end