module MotionDataWrapper::Model::Persistence::ClassMethods
Public Instance Methods
create(attributes={})
click to toggle source
# File lib/motion_data_wrapper/model/persistence.rb, line 11 def create(attributes={}) begin model = create!(attributes) rescue MotionDataWrapper::RecordNotSaved end model end
create!(attributes={})
click to toggle source
# File lib/motion_data_wrapper/model/persistence.rb, line 19 def create!(attributes={}) model = new(attributes) model.save! model end
new(attributes={})
click to toggle source
# File lib/motion_data_wrapper/model/persistence.rb, line 25 def new(attributes={}) alloc.initWithEntity(entity_description, insertIntoManagedObjectContext:nil).tap do |model| model.instance_variable_set('@new_record', true) attributes.each do |keyPath, value| model.setValue(value, forKey:keyPath) end end end