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
require 'rubygems' | |
puts ENV["GEM_HOME"] | |
require 'mongoid' | |
require 'mongoid/version' | |
puts "Using Mongoid: #{Mongoid::VERSION}" | |
Mongoid.master = Mongo::Connection.new.db("mongoid_playground") | |
class Orphan |
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 BasalPlan | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
include Mongoid::DeepVersioning | |
field :name, :type => String | |
belongs_to :user, :inverse_of => :basal_plan | |
has_many :basal_entries | |
accepts_nested_attributes_for :basal_entries, :reject_if => lambda { |attrs| attrs[:_delete].present? } |