|  | 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..11
 | 
						
						
						
							|  |  			self.papers.build
 | 
						
						
						
							|  |  		end
 | 
						
						
						
							|  |  	end
 | 
						
						
						
							|  | 
 | 
						
						
						
							|  | end
 |