lib/arcade/base.rb
# returns a list of updated records
returns a list of updated records
returns a list of updated records
def upsert **args
        set_statement = args.delete :set
        args.merge!( updated: DateTime.now ) if timestamps
        where_statement = args[:where] || args
        statement = if set_statement
                      { set: set_statement, where: where_statement }
                    else
                      { where: where_statement }
                    end
        result= query( **( { kind: :upsert  }.merge statement ) ).execute do | answer|
           z=  answer[:"$current"] &.load_rid(false)   
           error "Upsert failed", :load  unless z.is_a?  Arcade::Base
           z  
        end
      end
def upsert ** args set_statement = args . delete :set args . merge! ( updated : DateTime . now ) if timestamps where_statement = args [ :where ] || args statement = if set_statement { set : set_statement , where : where_statement } else { where : where_statement } end result = query ( ** ( { kind : :upsert } . merge statement ) ) . execute do | answer | z = answer [ :" $current " ] &. load_rid ( false ) error "Upsert failed" , :load unless z . is_a? Arcade :: Base z end end
returns a list of updated records
returns a list of updated records
#  do not autoload modelfiles #  return record
args