Class: Flounder::Query::Update

Inherits:
Base
  • Object
show all
Includes:
Returning
Defined in:
lib/flounder/query/update.rb

Overview

An update obtained by calling any of the chain methods on an entity.

Instance Attribute Summary

Attributes inherited from Base

#bind_values, #domain, #engine, #entity, #manager

Instance Method Summary collapse

Methods included from Returning

#returning, #returning_fields, #to_sql

Methods inherited from Base

#column_name_to_entity, #kick, #measure, #parse_conditions, #to_sql, #where, #with

Methods included from Helpers::Entity

#convert_to_entity, #entity_like?

Constructor Details

#initialize(domain, entity) ⇒ Update

Returns a new instance of Update.



9
10
11
12
13
# File 'lib/flounder/query/update.rb', line 9

def initialize domain, entity
  super(domain, Arel::UpdateManager, entity)

  manager.table entity.table
end

Instance Method Details

#set(fields) ⇒ Object

Add one row to the updates.



17
18
19
20
21
# File 'lib/flounder/query/update.rb', line 17

def set fields
  manager.set(
    fields.map { |k, v| 
      transform_tuple_for_set(k, v) })
end