Class: ROM::RethinkDB::Commands::Update

Inherits:
Commands::Update
  • Object
show all
Defined in:
lib/rom/rethinkdb/commands/update.rb

Instance Method Summary collapse

Instance Method Details

#datasetObject



23
24
25
# File 'lib/rom/rethinkdb/commands/update.rb', line 23

def dataset
  relation.dataset
end

#execute(tuple) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rom/rethinkdb/commands/update.rb', line 10

def execute(tuple)
  attributes = input[tuple]
  validator.call(attributes)
  tuple = attributes.to_h

  update(tuple)
end

#update(tuple) ⇒ Object



18
19
20
21
# File 'lib/rom/rethinkdb/commands/update.rb', line 18

def update(tuple)
  dataset.scope.update(tuple).run(dataset.connection)
  dataset.to_a
end