Class: Skynet::ActiveRecordAsync

Inherits:
Object
  • Object
show all
Includes:
SkynetDebugger
Defined in:
lib/skynet/active_record_extensions.rb

Class Method Summary collapse

Methods included from SkynetDebugger

#args_pp, #debug, #debug_header, #error, #fatal, included, #info, #log, #printlog, #stderr, #stdout, #warn

Class Method Details

.map(datas) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/skynet/active_record_extensions.rb', line 61

def self.map(datas)
  datas.each do |data| 
    begin            
      model = data[:model_class].constantize.find(data[:model_id])
      if data.key?(:opts)
        model.send(data[:method], *YAML.load(data[:opts]))
      else
        model.send(data[:method])
      end
      model.save if data[:save]
    rescue Exception => e
      error "Error in #{self} #{e.inspect} with data #{data.inspect}"
    end
  end
  return
end