module ActiveMongoid::Associations::RecordRelation::Builders::ClassMethods
Public Instance Methods
record_builder(name, metadata)
click to toggle source
# File lib/active_mongoid/associations/record_relation/builders.rb, line 8 def record_builder(name, metadata) define_method("build_#{name}") do |attributes = {}| record = metadata.klass.new(attributes) send("#{name}=", record) end self end
record_creator(name, metadata)
click to toggle source
# File lib/active_mongoid/associations/record_relation/builders.rb, line 16 def record_creator(name, metadata) define_method("create_#{name}") do |attributes = {}| record = metadata.klass.new(attributes) obj = send("#{name}=", record) record.save save if metadata.stores_foreign_key? obj end self end