This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/models/journal.rb

20 lines
306 B
Ruby

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
for i in 0..25
self.papers.build
end
end
end