Module: Engine2::ActionInsertSupport

Included in:
ArrayInsertAction, InsertAction
Defined in:
lib/engine2/action.rb

Instance Method Summary collapse

Instance Method Details

#allocate_record(handler, json_rec) ⇒ Object



949
950
951
952
953
954
955
956
# File 'lib/engine2/action.rb', line 949

def allocate_record handler, json_rec
    record = super(handler, json_rec)
    record.instance_variable_set(:"@new", true)
    model = assets[:model]
    model.primary_keys.each{|k|record.values.delete k} unless model.natural_key
    handler.permit !record.has_primary_key? unless model.natural_key
    record
end